Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reversed filename, is this possible? #385

Closed
jimicr opened this issue May 9, 2014 · 25 comments
Closed

Reversed filename, is this possible? #385

jimicr opened this issue May 9, 2014 · 25 comments

Comments

@jimicr
Copy link

jimicr commented May 9, 2014

Hey Devs,

Some releasegroups "hide" the filename of a movie by reversing it without a repair par.
Is it possible after a failed idbm lookup to try to reverse the filename and do another lookup?
I am no dev and don't know how to implement it. But it would fix for me at least a lot of pp errors.

jimi

@clinton-hall
Copy link
Owner

We already reverese the QoQ releases. and there is a reverse script (for TV shows) that can be used with NZBGet that can be found here

https://github.com/Prinz23/nzbget-pp-reverse/blob/master/reverse_name.py

That said, I'm keen to implement this, so can you give some examples of releases and the file names?

@Prinz23

Does your script only work with TV series, or will this also match movies that are reversed?

@TRaSH-
Copy link

TRaSH- commented May 10, 2014

i use that script also but i can't always use it.
let me try to explain:
some releases uses file names like fjniwfnijrnf.mkv.
but the directory name(nzb-name i think) is the correct name of the release.
so i use videosort with the serie formatting: %dn/%dn (%dn - original directory name (nzb-name))
this way the filename is renamed to the name of the directory.
making it all good looking again(i prefer original scene release name also for follow-up scripts).

but groups that use the reverse names also use random letters/numbers for there nzb-name,
so i can't use videosort for those.
being that it's a automated process i'm not able to turn it on or off on time.
so when the reverse script does it things to fix it,
videosort messes it up again because the directory name is a random of letters/numbers.
so if the reverse script would rename also the directory to the fixed filename,
then when videosort kicks-in the filenames and the directory are correct and could be ignored.

so i requested at the guy who made the reverse name script if he also could rename the directory to the reverse name of the filename,
this way when videosort kicks-in the filenames and the directory are correct and could be ignored.

going to ask on the videosort topic if they are willing to add the reverse name in there script.
it's all options to turn on/off

@Prinz23
Copy link
Contributor

Prinz23 commented May 12, 2014

That script should also work for most Movies, since it looks for specific reversed patterns that are in most release names.

@clinton-hall
Copy link
Owner

Thanks @Prinz23
I'll look to add this, or similar... Just needed to check since you use some regex that I just can't quite follow. (I never did understand regex...)

@clinton-hall
Copy link
Owner

8a277ff

Hopefully this now identifies most reversed filenames. If running in NZBGet with Prinz23's reverse_name script I have checked and this shouldn't do anything (i.e it won't reverse again)

@Prinz23
Copy link
Contributor

Prinz23 commented May 13, 2014

My regex simply check for the reverse pattern of: .sxxexx. , .720p. , .1080p. , .1080i. , .bluray. , and so on.... If such a pattern in reverse is found the Name is reversed, it's very unlikely that a normal release has such a pattern in it.

And if the reverse of .sxxexx. is found there is an additional function that removes on word letters within words, since QoQ has all words with starting capital letter and sometimes it puts points in the middle of the word to prevent autoindexing.

@TRaSH-
Copy link

TRaSH- commented May 13, 2014

so does this mean that i don't need to use @Prinz23 script anymore ?

@Prinz23
Copy link
Contributor

Prinz23 commented May 13, 2014

There was a typo in the last RegEx in my script.

Fix:
Prinz23/nzbget-pp-reverse@de1d725

clinton-hall added a commit that referenced this issue May 13, 2014
@clinton-hall
Copy link
Owner

@TRaSH-

If processing to SickBeard or CouchPotato using these scripts then that is correct, you don't need to use @Prinz23 script anymore. However using both scripts together will not cause any issues and any other processing that doesn't use nzbToMedia scripts should use Prinz23's script.

@TRaSH-
Copy link

TRaSH- commented May 14, 2014

Okay just need to find a way to solve the random filename releases,
I posted the issue on @Prinz23 git.
If nzbtomedia could rename those also I could leave out the videosort script.

@clinton-hall
Copy link
Owner

I believe this is solved....

elif garbage_name.search(head) is not None:

def reverse_filename(filename, dirname, name):

Let me know if it still causes issues, but essentially this looks for any (media) filename that is just letters/numbers without any spaces, unser-scores, hyphens, periods etc, then checks if any known regex matches for "meta" info (e.g. 720p 1080p bluray br-rip dvd-rip etc...) in the release name and the directory name. if it finds a valid release name it will replace the filename with that release name....

e.g

Directory name: The.Big.Bang.Theory.S09E18.720p.WEB-DL.DD5.1.H.264-EC
Release name: The.Big.Bang.Theory.S09E18.720p.WEB-DL.DD5.1.H.264-ECI
Filename:186796.mkv

this will be renamed to The.Big.Bang.Theory.S09E18.720p.WEB-DL.DD5.1.H.264-EC/The.Big.Bang.Theory.S09E18.720p.WEB-DL.DD5.1.H.264-EC.mkv

@clinton-hall
Copy link
Owner

please let me know if this is not the case....

@Prinz23 please feel free to use this in your script... and test/improve my regex (only just started playing with this)... no doubt there is room for improvement...

@TRaSH-
Copy link

TRaSH- commented May 14, 2014

Oh cool I will disable videosort,
And wait till I get a file like this

@Prinz23
Copy link
Contributor

Prinz23 commented May 14, 2014

Yes I'm just extending the regex list now, because it was not intended for Movie use, so it has many pattern missing for Movies.

@clinton-hall
Copy link
Owner

Cool... I'll watch your edits and add here too...

Hope you don't mind me borrowing your code, but I don't like reinventing the wheel, and. SABnzbd doesn't allow for multiple scripts the same way NZBGet does.

@Prinz23
Copy link
Contributor

Prinz23 commented May 14, 2014

There a 2 pattern you can use for your media_list , but can't be used for the reverse detection because they are the exact reverse of each other. (They would reverse any file with divx or xvid in the name forth and back again every time - LOL )

r"\bdivx\b", r"\bxvid\b"

clinton-hall added a commit that referenced this issue May 14, 2014
@clinton-hall
Copy link
Owner

thanks... added all those tags and 2 extras r".pal.", r".secam." (reverse = r".lap.", r".maces.")

@Prinz23
Copy link
Contributor

Prinz23 commented May 14, 2014

I didn't add .lap. since this is a english word and can be in titles. This would reverse Titles with this word in it.

I also didn't add .mac. for that reason.

@clinton-hall
Copy link
Owner

Good catch...thanks.

@Prolesious
Copy link

this is still on going. for example.

The.Tomorrow.People.S01E09.Death's.Door.720p.WEB-DL.DD5.1.H.264-ECI-NZBgeek was downloaded with a resulting file name of 21a17666c57a4695bebe9c2a2c5d4c4f.mkv.

no processing was done and therefore nothing was sent to NZBdrone to move or whatnot.

       [10:45:17] [INFO]::MAIN: Loading config from [H:\nzbToMedia-dev\autoProcessMedia.cfg]

[10:45:17] [INFO]::MAIN: Checking database structure...
[10:45:17] [INFO]::MAIN: Checking if source needs an update
[10:45:18] [INFO]::MAIN: No update needed
[10:45:18] [INFO]::MAIN: nzbToMedia Version:ba525234c3b1ee32cfb31a63e0ad5cb890727433 Branch:dev (Windows 8)
[10:45:18] [INFO]::MAIN: #########################################################
[10:45:18] [INFO]::MAIN: ## ..::[nzbToMedia.py]::.. ##
[10:45:18] [INFO]::MAIN: #########################################################
[10:45:18] [INFO]::MAIN: Script triggered from SABnzbd
[10:45:18] [INFO]::MAIN: Auto-detected SECTION:NzbDrone
[10:45:18] [INFO]::MAIN: Calling NzbDrone:tv to post-process:The.Tomorrow.People.S01E09.Death's.Door.720p.WEB-DL.DD5.1.H.264-ECI-NZBgeek
[10:45:18] [INFO]::MAIN: Attempting to verify tv fork
[10:45:18] [INFO]::MAIN: NzbDrone:tv fork set to default
[10:45:18] [INFO]::TRANSCODER: Checking [21a17666c57a4695bebe9c2a2c5d4c4f.mkv] for corruption, please stand by ...
[10:45:18] [INFO]::TRANSCODER: SUCCESS: [21a17666c57a4695bebe9c2a2c5d4c4f.mkv] has no corruption.
Traceback (most recent call last):
File "H:\nzbToMedia-dev\nzbToMedia.py", line 539, in
exit(main(sys.argv))
File "H:\nzbToMedia-dev\nzbToMedia.py", line 471, in main
download_id='')
File "H:\nzbToMedia-dev\nzbToMedia.py", line 365, in process
inputCategory)
File "H:\nzbToMedia-dev\nzbtomedia\autoProcess\autoProcessTV.py", line 96, in processEpisode
process_all_exceptions(inputName.lower(), dirName)
File "H:\nzbToMedia-dev\nzbtomedia\nzbToMediaSceneExceptions.py", line 31, in process_all_exceptions
exception(filename, parentDir, name)
File "H:\nzbToMedia-dev\nzbtomedia\nzbToMediaSceneExceptions.py", line 37, in replace_filename
logging.debug("Replacing file name %s with directory name %s" % (head, newname), EXCEPTION)
NameError: global name 'EXCEPTION' is not defined

@Prinz23
Copy link
Contributor

Prinz23 commented May 14, 2014

Added/Changed a few more Regex's in my script and added a garbage filename renamer like here.

Prinz23/nzbget-pp-reverse@bc3d9aa

@clinton-hall
Copy link
Owner

@Prolesious
Sorry... That was actually an issue with the logger. I'll fix shortly

clinton-hall added a commit that referenced this issue May 14, 2014
@clinton-hall
Copy link
Owner

the fact that the script gave the error you posted shows that the script identified that renaming was required... so hopefully this logging fix will resolve these issues now.

please try again.

@Prinz23
Copy link
Contributor

Prinz23 commented May 14, 2014

You added a typo:

r"\.[pi]p084\."

should be:

r"\.[pi]084\."

clinton-hall added a commit that referenced this issue May 14, 2014
@clinton-hall
Copy link
Owner

thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants