mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.51k stars 201 forks source link

enhancement : Tagdata send to Subliminal #1459

Closed Petterooe closed 3 years ago

Petterooe commented 3 years ago

When tagdata is not found user can input tmdb id to fetch it, this data should also be used in subliminal. If guessit fail to produce searchable result, subliminal will most probably not found subs because it also use guessit . Most people probably not use manual.py but the ask for tagdata can later on be applied to downloads as well. In my sickbeard script downloads stops and wait for tagging otherwise I will loose subs and plex not find metadata. I never used sonarr,sickbeard,radarr so I'm not aware if they handle tagging,subs better. Here is an example of creating a new guess from tagdata in def processFile manual.py:

if not guess and tagdata:# guess is nulled when manual input of tagdata
    tmpfilename= tagdata.title + " " + ("(" + tagdata.date + ")" if tagdata.date else "") if tagdata.mediatype ==
    MediaType.Movie else "%s S%02dE%02d - %s %s" %(tagdata.showname, int(tagdata.season), int(tagdata.episode),
    tagdata.title,"(" + tagdata.airdate + ")" if tagdata.airdate else "") if tagdata.mediatype == MediaType.TV else None
    guess = guessit.guessit(tmpfilename)
output = mp.process(inputfile, True, info=info, original=original,guess=guess)

And then send that guess to subliminal:

video = subliminal.Video.fromguess(os.path.abspath(inputfile),guess)
mdhiggins commented 3 years ago

Want to turn this into a pull request?

Petterooe commented 3 years ago

Feel that I should not make suggestions before I know what radarr,sickbeard,usenet,SABnzbd etc. is.

mdhiggins commented 3 years ago

It wasn't a bad suggestion, no need to close, I'll look into this

mdhiggins commented 3 years ago

I wonder if the appropriate way to handle this however would be to use refiners

https://subliminal.readthedocs.io/en/latest/api/refiners.html

Petterooe commented 3 years ago

Yes! using a dummy filename as my suggestion is hardly a professional way when the data already is separated in the taginfo. A related thing is the asking for tagging, there should be a third option, only ask if tagdata not found wich is the preferred option for folder encoding and downloads.

parser.add_argument('-a', '--auto', help="Level ask for tagging if no arg=always ask,1=ask if not found,2=auto the script will not prompt you for any further input, good for batch files. It will guess the metadata using guessit")

if not silent==3:
    if tagdata:
        print("Proceed using guessed identification from filename?")
        if silent==2 or getYesNo():
            return tagdata,guess

And yes it would be more efficient to make a pull request, only I must learn how. I think there is a great need for your script without the automated downloaders, only apply the tagging procedure from manual.py to deluge encode in delugePostProcess.py and it's as good as radarr and others.

mdhiggins commented 3 years ago

I've long maintained that the best solution is to integrate with the managers to ensure tagging data is as accurate as possible. Guessing is inherently less accurate so the official solution is direct integration with the media managers. People are free to use manual.py or modified versions of the post downloader scripts if that better suites their needs but the whole stack is designed to handling tagging as the final step for maximum accuracy which is critical when automating something like this.

I'll need a little time to review your pull request and I have already started working on a similar solution on my end so it'll probably be a merger of the two concepts I'll follow up here. Despite adding the refiners and the data from the manual information it doesn't seem to actually download the subtitles like its supposed to when the file is named correctly so I need to sort that out still

mdhiggins commented 3 years ago

4ca5f2b41537304eaad07b9347a71a68404d3338

There's my solution I supplement the subliminal data with the tagdata without actually using a fake guess

This solution is nice for a couple reasons

It doesn't require the fake guess and uses the bult in refiners It adds data from the tagdata class which should always be fairly accurate whenever available Still allows for proper file scanning and data to be gathered using the usual video scanning methods