[PP-Script] VideoSort - better video sorting

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 03 Apr 2015, 11:03

Update: version 6.1:
  • updated library babelfish used by guessit; this fixes a rare error regarding unicode characters.
Download link is in the first post.

kgoroway
Posts: 3
Joined: 30 Apr 2015, 17:33

Re: [PP-Script] VideoSort - better video sorting

Post by kgoroway » 30 Apr 2015, 17:36

Sorry for incoming quote from ancient forum post, but here it is:
minimeh wrote:
minamhere wrote:I am trying to create a post processing script that will run after VideoSort. I want to copy the resulting file to a secondary location.

Is there a way to determine the final filename (or final path) after VideoSort renames and moves it? I know I can get FINALDIR, but I can't figure out how to get the final filename.
I encountered a similar need to get the final filenames. My solution was to patch VideoSort.py. In the latest version of VideoSort.py, I replace (starting at line 1052):

Code: Select all

# Inform NZBGet about new destination path
finaldir = ''
uniquedirs = []
for filename in moved_dst_files:
	dir = os.path.dirname(filename)
	if dir not in uniquedirs:
		uniquedirs.append(dir)
		finaldir += '|' if finaldir != '' else ''
		finaldir += dir

if finaldir != '':
	print('[NZB] FINALDIR=%s' % finaldir)
with

Code: Select all

# Inform NZBGet about new destination path
finaldir = ''
uniquedirs = []
unique_names = set()

for filename in moved_dst_files:
	dir = os.path.dirname(filename)
	if dir not in uniquedirs:
		uniquedirs.append(dir)
		finaldir += '|' if finaldir != '' else ''
		finaldir += dir
		# Strip off the extension
		path = os.path.splitext(filename)[0]
		# Add the base name to the set. This is a no-op if the base name already exists
		unique_names.add(os.path.split(path)[1])

finalnames = ''
for filename in unique_names:
	if len(finalnames) == 0:
		finalnames = filename
	else:
		finalnames += "|%s" % filename    

if finaldir != '':
	print('[NZB] FINALDIR=%s' % finaldir)
if len(finalnames) > 0:
	print('[NZB] NZBPR_FINALENAMES=%s' % finalnames)
Notice that this collects the final filenames minus the extension. That way, I can readily find the media file and its satellites such as subtitles files.

In my pp script that uses the final filenames, I have something like this

Code: Select all

	finaldirectory = os.environ.get('NZBPP_FINALDIR', '')
	if len(finaldirectory) == 0:
		print('[INFO] No final directories passed to this post process script.')
		sys.exit(POSTPROCESS_NONE)
	finaldirectories = finaldirectory.split('|')

	finalname = os.environ.get('NZBPR_FINALENAMES', '')
	if len(finalname) == 0:
		print('[INFO] No final file names passed to this post process script.')
		sys.exit(POSTPROCESS_NONE)
	finalnames = finalname.split('|')
	for finaldirectory in finaldirectories:
		if DEBUG:
			print "finaldirectory = \"%s\"" % finaldirectory
		if os.path.exists(finaldirectory):
			for finalname in finalnames:
				if DEBUG:
					print "finalname = \"%s\"" % finalname
Whenever a new VideoSort.py is released, I use a merge tool to patch it. Not ideal, but it works for me.
Has this ever been simplified? I understand that I can use listgroups to get the FinalDir, but is there any way to get the "FinalName" other than patching VideoSort?

Thanks!

davyjones
Posts: 7
Joined: 26 Mar 2015, 22:54

Keeping words like Remasterd, Director's Cut, Remastered,etc

Post by davyjones » 07 May 2015, 00:13

Just wondering if anyone knows how to set up these rules using the VideoSort script in NZBGet? Currently these words are dropping off the title for some reason. Thanks in advance for the help!

davyjones
Posts: 7
Joined: 26 Mar 2015, 22:54

Re: [PP-Script] VideoSort - better video sorting

Post by davyjones » 07 May 2015, 20:34

Hi, I'm trying to use VideoSort to rename two separate feeds from DOGnzb: UFC PPV, UFC Fight Night. How can I use VideoSort to rename these? Is this possible? I'm a little confused about the OtherTvDir and OtherTvFormat and how they work together. I do have categories and destination directories set up for UFC PPV and UFC Fight Night but not sure exactly how to create naming rules for these two cases. Can someone please help/guide me with this? Thanks in advance for the help.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 08 May 2015, 09:42

What is UFC, few examples of how titles look like?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: Keeping words like Remasterd, Director's Cut, Remastered

Post by hugbug » 08 May 2015, 09:48

davyjones wrote:Just wondering if anyone knows how to set up these rules using the VideoSort script in NZBGet? Currently these words are dropping off the title for some reason. Thanks in advance for the help!
Please activate option Verbose on VideoSort and post the logging of the script after processing of a such release.

davyjones
Posts: 7
Joined: 26 Mar 2015, 22:54

Re: [PP-Script] VideoSort - better video sorting

Post by davyjones » 08 May 2015, 21:25

hugbug wrote:What is UFC, few examples of how titles look like?
They are usually just numbered for example:

UFC 183
UFC 184
UFC 185

And same for UFC Fight Night.

UFC Fight Night 65
UFC Fight Night 66
UFC Fight Night 67

UFC is Ultimate Fighting Championship. Greatest sport ever ;) If you have never heard of UFC you have to watch it. Definitely a man's sport.

davyjones
Posts: 7
Joined: 26 Mar 2015, 22:54

Re: Keeping words like Remasterd, Director's Cut, Remastered

Post by davyjones » 08 May 2015, 21:26

hugbug wrote:
davyjones wrote:Just wondering if anyone knows how to set up these rules using the VideoSort script in NZBGet? Currently these words are dropping off the title for some reason. Thanks in advance for the help!
Please activate option Verbose on VideoSort and post the logging of the script after processing of a such release.
Actually, I realized Plex has a problem if these words are left in the title so I think I will just ignore them. Thanks anyway!

zurdar
Posts: 7
Joined: 03 Sep 2014, 17:06

Re: [PP-Script] VideoSort - better video sorting

Post by zurdar » 17 May 2015, 17:16

Hello,

I'm using videosort from quite some time and it always worked very well (it still does btw). For now it moves all my movies to one folder (named "Filmy") and formats file names according to my needs. Now I want to create separate subfolder for every downloaded movie and don't know how to do it. My guess is to change MoviesDir from current "/mnt/HD_a2/Filmy" to "/mnt/HD_a2/Filmy/%t (%y)" but I'm not sure it's the right way. Tried to find some documentation, but it looks like this is undocumented, if even possible.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] VideoSort - better video sorting

Post by hugbug » 17 May 2015, 18:04

Keep MoviesDir as it was before and use slashes in MoviesFormat to create subdirectories, for example:

Code: Select all

MoviesFormat=%t (%y)/%t

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests