show id per file properties mwe
This commit is contained in:
19
bin/ffx.py
19
bin/ffx.py
@@ -251,24 +251,23 @@ def help():
|
||||
@click.argument('filename', nargs=1)
|
||||
def inspect(ctx, filename):
|
||||
|
||||
# if 'database' not in ctx.obj.keys():
|
||||
# ctx.obj['database'] = databaseContext()
|
||||
|
||||
try:
|
||||
|
||||
fp = FileProperties(ctx.obj, filename)
|
||||
md = fp.getMediaDescriptor()
|
||||
|
||||
print(md.getTags())
|
||||
click.echo('\nFile properties:\n')
|
||||
|
||||
click.echo(md.getTags())
|
||||
|
||||
for at in md.getAudioTracks():
|
||||
print(f"Audio: {at.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in at.getTags().items()])}")
|
||||
click.echo(f"Audio: {at.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in at.getTags().items()])}")
|
||||
|
||||
for st in md.getSubtitleTracks():
|
||||
print(f"Subtitle: {st.getLanguage()} {'|'.join([[f"{k}={v}" for (k,v) in st.getTags().items()]])}")
|
||||
click.echo(f"Subtitle: {st.getLanguage()} {'|'.join([f"{k}={v}" for (k,v) in st.getTags().items()])}")
|
||||
|
||||
except Exception as ex:
|
||||
raise click.ClickException(f"This file does not contain any audiovisual data: {ex}")
|
||||
|
||||
click.echo('\nRecognized pattern:\n')
|
||||
|
||||
click.echo(f"Show Id: {fp.getShowId()}")
|
||||
|
||||
# for d in sd:
|
||||
# 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 ffx.model.pattern import Pattern
|
||||
|
||||
|
||||
class FileProperties():
|
||||
|
||||
@@ -51,10 +53,12 @@ class FileProperties():
|
||||
file_index += 1
|
||||
|
||||
|
||||
pc = PatternController(context)
|
||||
pattern = pc.matchFilename(self.__sourceFilename)
|
||||
self.__pc = PatternController(context)
|
||||
|
||||
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 []
|
||||
#
|
||||
# print(f"season={season} episode={episode} file={file_index}")
|
||||
@@ -213,3 +217,9 @@ class FileProperties():
|
||||
# formatData = self.getFormatData()
|
||||
# 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()
|
||||
|
||||
|
||||
def matchFilename(self, filename):
|
||||
def matchFilename(self, filename) -> Pattern:
|
||||
|
||||
try:
|
||||
s = self.Session()
|
||||
|
||||
Reference in New Issue
Block a user