morpheus65535 / bazarr

Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you.
https://www.bazarr.media
GNU General Public License v3.0
2.87k stars 223 forks source link

Sonarr renaming makes getting wrong subtitle #46

Closed D3athSpank closed 6 years ago

D3athSpank commented 6 years ago

Hi!

I have renaming enabled in sonarr, hence all my episodes are named: {Series Title} - S{season:00}E{episode:00} - {Episode Title} from file ex: Shetland.S01E01.1080p.WEB.h264-SFM-xpost.mkv

Will this break bazarr to find the exact right subtitle?

morpheus65535 commented 6 years ago

Bazarr rely on Subliminal library to download subtitles. Subliminal work best if don’t rename files. For some providers, it can use file hash but not for all of them. I suggest you try it without renaming so Subliminal can do an educated guess.

D3athSpank commented 6 years ago

Ok, could it be possible to make Bazarr download subtitles targeting the real filename that sonarr is downloading, prior sonar renaming, instead?

morpheus65535 commented 6 years ago

I'm afraid not. Sonarr doesn't keep track of original filename, only the current one.

Maybe you can send me the output of a call to your Sonarr API?

/api/episode?seriesId=<seriesId>&apikey=<apikey>

Replace seriesId by a valid series with episode files renamed (you can get it from Bazarr episode pageURL). Fill in your API key.

D3athSpank commented 6 years ago

Heres the output (subset of a episode)

{
    "seriesId": 6,
    "episodeFileId": 59,
    "seasonNumber": 3,
    "episodeNumber": 6,
    "title": "Episode 6",
    "airDate": "2016-03-04",
    "airDateUtc": "2016-03-04T21:00:00Z",
    "overview": "As the investigation reaches its final stages, Detective Inspector Perez and his team discover the person responsible for the deaths of Robbie Morton and Michael Thompson is closer to home than any of them thought.",
"episodeFile": {
"seriesId": 6,
        "seasonNumber": 3,
        "relativePath": "Season 3/Shetland - S03E06 - Episode 6.mkv",
        "path": "/tv/Shetland/Season 3/Shetland - S03E06 - Episode 6.mkv",
        "size": 1124741796,
        "dateAdded": "2018-02-18T18:31:03.614782Z",
        "sceneName": "Shetland.S03E06.1080p.WEB.h264-SFM-xpost",
        "quality": {
            "quality": {
                "id": 3,
                "name": "WEBDL-1080p"
            },
            "revision": {
                "version": 1,
                "real": 0
            }
        },
        "qualityCutoffNotMet": false,
        "id": 59
    },
    "hasFile": true,
    "monitored": true,
    "absoluteEpisodeNumber": 14,
    "unverifiedSceneNumbering": false,
    "id": 82
},

There is a field called sceneName that looks interesting... and it maches the file that is listed under History for that episode.

While, the relativePath, path is the renamed filename

D3athSpank commented 6 years ago

Did some more investigation and it looks like that sceneName field is only valid for episodes downloaded through sonarr, and not for episodes imported, which makes sense.

But to get Bazarr to look for subtitles with sceneName as an option would be awesome

morpheus65535 commented 6 years ago

Thank for the output. It make sense and I'll take a look at it.

D3athSpank commented 6 years ago

@morpheus65535 Awesome thank you!

morpheus65535 commented 6 years ago

You can try the development branch that should do exactly what you're looking for. Please report back whether it works or not. Thanks!

D3athSpank commented 6 years ago

Thank you! I will try this, although Im using your docker version, so i need to figure out how to get this development branch into a docker container :smile:

Ok, i found on your wiki how to run from source, will run it on my Win machine using the guide later today.

morpheus65535 commented 6 years ago

You don't have to do anything complicated. In settings, you can change to development branch. In system-->tasks, update Bazarr and restart your docker container.

D3athSpank commented 6 years ago

Nice! Will test as soon as i get home!

D3athSpank commented 6 years ago

Ok so I switch to development, ran the task, and restarted Docker. Then I redownloaded an episode in Sonarr Heres the api output:

{    
    "seriesId": 6,
    "episodeFileId": 69,
    "seasonNumber": 2,
    "episodeNumber": 6,
    "title": "Blue Lightning - Part 2",
    "airDate": "2014-04-15",
    "airDateUtc": "2014-04-15T20:00:00Z",
    "overview": "Time is running out for Detective Inspector Perez as prime suspect Peter Latimer lies critically ill in hospital. Was the fire a drunken accident, or was Peter Latimer the second victim of a murderer still free on Fair Isle?",
    "episodeFile": {
        "seriesId": 6,
        "seasonNumber": 2,
        "relativePath": "Season 2/Shetland - S02E06 - Blue Lightning - Part 2.mkv",
        "path": "/tv/Shetland/Season 2/Shetland - S02E06 - Blue Lightning - Part 2.mkv",
        "size": 836648837,
        "dateAdded": "2018-02-23T19:06:53.427204Z",
        "sceneName": "Shetland.S02E06.720p.HDTV.x264-TLA",
        "quality": {
            "quality": {
                "id": 4,
                "name": "HDTV-720p"
            },
            "revision": {
                "version": 1,
                "real": 0
            }
        },
        "qualityCutoffNotMet": false,
        "id": 69
    },
    "hasFile": true,
    "monitored": true,
    "absoluteEpisodeNumber": 8,
    "unverifiedSceneNumbering": false,
    "id": 76

}

So the sceneName is there

"sceneName": "Shetland.S02E06.720p.HDTV.x264-TLA",

and it gets renamed by Sonarr to

 "path": "/tv/Shetland/Season 2/Shetland - S02E06 - Blue Lightning - Part 2.mkv",

But the problem is I can not find in any logs of Bazarr if the file download is subtitel for the sceneName or if it uses the renamed on...

So Im a bit unsure if this is working as expected... or if Im even running the development

morpheus65535 commented 6 years ago

Which version of Bazarr are you running, 0.3.2 or 0.3.5? The latest is from the dev branch.

Can you run Bazarr with debug log level (restart required), clear the log, download a subtitles and send me the log? You can do it in private over private message in Discord if you want.

D3athSpank commented 6 years ago

Ok i did that and have the log, but i dont have Discord.... And I am on 0.3.5 😄

Edit: Apparently one could send message without an account on Discord so I think I managed to send you the logfile

morpheus65535 commented 6 years ago

Should I consider this issue closed?

D3athSpank commented 6 years ago

Yes, its working as excpected in dev branch :smile:

morpheus65535 commented 6 years ago

Fine, I’ll merge it to master branch and close this issue. Thanks for feedback!