Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
version 3.0
Browse files Browse the repository at this point in the history
Historical commit version 3.0 (08.09.2013).
  • Loading branch information
hugbug committed Sep 8, 2013
1 parent c875065 commit 86603c5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
videosort-3.0:
- added for seasoned TV shows: if year in the file name goes directly after
show name, it will be added to show name. This may be necessary for
media players like XBMC, Boxee or Plex (or anyone using TheTVDB) to
properly index TV show. New option option "SeriesYear";
- added detection of obfuscated file names; if such file name is detected
a nzb-name is used instead.

videosort-2.0:
- new options "TvCategories", "OtherTvDir" and "OtherTvFormat" for TV shows, whose file names look like movies (neither series nor dated shows);
- new format specifier "{TEXT}" to make text lowercase;
- new format specifiers "%y", "%decade", "%0decade" for seasoned TV shows;
- added support for multi episode file names (example: My.Show.S01E02-03.mkv);
- new option "EpisodeSeparator" to adjust formatting of multi episode file names;
Expand Down
47 changes: 43 additions & 4 deletions VideoSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# Author: Andrey Prygunkov ([email protected]).
# Web-site: http://nzbget.sourceforge.net/VideoSort.
# License: GPLv3 (http://www.gnu.org/licenses/gpl.html).
# PP-Script Version: 2.0.
# PP-Script Version: 3.0.
#
# NOTE: This script requires Python 2.x to be installed on your system.

Expand Down Expand Up @@ -151,6 +151,14 @@
# resulting filename will be "My Show - S01E02E03.mkv".
#EpisodeSeparator=E

# Treat year following title as part of title (yes, no).
#
# For seasoned TV shows: if year in the file name goes directly after
# show name, it will be added to show name. This may be necessary for
# media players like XBMC, Boxee or Plex (or anyone using TheTVDB) to
# properly index TV show.
#SeriesYear=yes

# Formatting rules for dated TV shows.
#
# Specifiers:
Expand Down Expand Up @@ -277,6 +285,7 @@
satellites=len(satellite_extensions)>0
lower_words=os.environ['NZBPO_LOWERWORDS'].replace(' ', '').split(',')
upper_words=os.environ['NZBPO_UPPERWORDS'].replace(' ', '').split(',')
series_year=os.environ.get('NZBPO_SERIESYEAR', 'yes') == 'yes'

tv_categories=os.environ['NZBPO_TVCATEGORIES'].lower().split(',')
category=os.environ.get('NZBPP_CATEGORY', '');
Expand Down Expand Up @@ -747,15 +756,31 @@ def add_dated_mapping(guess, mapping):
def guess_info(filename):
""" Parses the filename using guessit-library """

if force_nzbname:
use_nzbname = force_nzbname

if not use_nzbname:
fn = os.path.splitext(os.path.basename(filename))[0]
if fn.find('.')==-1 and fn.find('_')==-1 and fn.find(' ')==-1:
print("Detected obfuscated filename %s, using NZB-Name instead" % os.path.basename(filename))
use_nzbname = True

if use_nzbname:
guessfilename = os.path.join(os.path.dirname(filename), os.path.basename(download_dir)) + os.path.splitext(filename)[1]
else:
guessfilename = filename

guess = guessit.guess_file_info(guessfilename, filetype = 'autodetect', info = ['filename'])

if verbose:
print('Guessing: %s' % guessfilename)

matcher = guessit.matcher.IterativeMatcher(unicode(guessfilename), filetype='autodetect', opts=['nolanguage', 'nocountry'])
mtree = matcher.match_tree
guess = matcher.matched()

if verbose:
print(mtree)
for node in mtree.nodes():
if node.guess:
print(node.guess)
print(guess.nice_string())

# fix some strange guessit guessing:
Expand All @@ -766,8 +791,22 @@ def guess_info(filename):
guess['title'] = guess.get('series')
guess['year'] = '1900'
if verbose:
print('episode without episodeNumber is a movie')
print(guess.nice_string())

# detect if year is part of series name
if guess['type'] == 'episode' and series_year:
last_node = None
for node in mtree.nodes():
if node.guess:
if last_node != None and node.guess.get('year') != None and last_node.guess.get('series') != None:
guess['series'] += ' ' + str(guess['year'])
if verbose:
print('year is part of title')
print(guess.nice_string())
break
last_node = node

if guess['type'] == 'movie':
date = guess.get('date')
if date:
Expand Down
Empty file modified lib/guessit/ISO-3166-1_utf8.txt
100644 → 100755
Empty file.
Empty file modified lib/guessit/ISO-639-2_utf-8.txt
100644 → 100755
Empty file.

0 comments on commit 86603c5

Please sign in to comment.