show id per file properties mwe
This commit is contained in:
23
bin/ffx.py
23
bin/ffx.py
@@ -251,24 +251,23 @@ def help():
|
|||||||
@click.argument('filename', nargs=1)
|
@click.argument('filename', nargs=1)
|
||||||
def inspect(ctx, filename):
|
def inspect(ctx, filename):
|
||||||
|
|
||||||
# if 'database' not in ctx.obj.keys():
|
fp = FileProperties(ctx.obj, filename)
|
||||||
# ctx.obj['database'] = databaseContext()
|
md = fp.getMediaDescriptor()
|
||||||
|
|
||||||
try:
|
click.echo('\nFile properties:\n')
|
||||||
|
|
||||||
fp = FileProperties(ctx.obj, filename)
|
click.echo(md.getTags())
|
||||||
md = fp.getMediaDescriptor()
|
|
||||||
|
|
||||||
print(md.getTags())
|
for at in md.getAudioTracks():
|
||||||
|
click.echo(f"Audio: {at.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in at.getTags().items()])}")
|
||||||
|
|
||||||
for at in md.getAudioTracks():
|
for st in md.getSubtitleTracks():
|
||||||
print(f"Audio: {at.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in at.getTags().items()])}")
|
click.echo(f"Subtitle: {st.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in st.getTags().items()])}")
|
||||||
|
|
||||||
for st in md.getSubtitleTracks():
|
|
||||||
print(f"Subtitle: {st.getLanguage()} {'|'.join([[f"{k}={v}" for (k,v) in st.getTags().items()]])}")
|
|
||||||
|
|
||||||
except Exception as ex:
|
click.echo('\nRecognized pattern:\n')
|
||||||
raise click.ClickException(f"This file does not contain any audiovisual data: {ex}")
|
|
||||||
|
click.echo(f"Show Id: {fp.getShowId()}")
|
||||||
|
|
||||||
# for d in sd:
|
# for d in sd:
|
||||||
# click.echo(f"{d['codec_name']}{' (' + str(d['channels']) + ')' if d['codec_type'] == 'audio' else ''}")
|
# click.echo(f"{d['codec_name']}{' (' + str(d['channels']) + ')' if d['codec_type'] == 'audio' else ''}")
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ from .pattern_controller import PatternController
|
|||||||
|
|
||||||
from .process import executeProcess
|
from .process import executeProcess
|
||||||
|
|
||||||
|
from ffx.model.pattern import Pattern
|
||||||
|
|
||||||
|
|
||||||
class FileProperties():
|
class FileProperties():
|
||||||
|
|
||||||
@@ -51,10 +53,12 @@ class FileProperties():
|
|||||||
file_index += 1
|
file_index += 1
|
||||||
|
|
||||||
|
|
||||||
pc = PatternController(context)
|
self.__pc = PatternController(context)
|
||||||
pattern = pc.matchFilename(self.__sourceFilename)
|
|
||||||
|
|
||||||
click.echo(pattern)
|
self.__pattern = self.__pc.matchFilename(self.__sourceFilename)
|
||||||
|
|
||||||
|
|
||||||
|
# click.echo(pattern)
|
||||||
# matchingFileSubtitleDescriptors = sorted([d for d in availableFileSubtitleDescriptors if d['season'] == season and d['episode'] == episode], key=lambda d: d['stream']) if availableFileSubtitleDescriptors else []
|
# matchingFileSubtitleDescriptors = sorted([d for d in availableFileSubtitleDescriptors if d['season'] == season and d['episode'] == episode], key=lambda d: d['stream']) if availableFileSubtitleDescriptors else []
|
||||||
#
|
#
|
||||||
# print(f"season={season} episode={episode} file={file_index}")
|
# print(f"season={season} episode={episode} file={file_index}")
|
||||||
@@ -213,3 +217,9 @@ class FileProperties():
|
|||||||
# formatData = self.getFormatData()
|
# formatData = self.getFormatData()
|
||||||
# streamData = self.getStreamData()
|
# streamData = self.getStreamData()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getShowId(self) -> int:
|
||||||
|
return self.__pattern.getShowId() if self.__pattern is not None else -1
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ class PatternController():
|
|||||||
s.close()
|
s.close()
|
||||||
|
|
||||||
|
|
||||||
def matchFilename(self, filename):
|
def matchFilename(self, filename) -> Pattern:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
s = self.Session()
|
s = self.Session()
|
||||||
|
|||||||
Reference in New Issue
Block a user