some tweaks for the episode guessing
[smewt:guessit.git] / guessit.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # GuessIt - A library for guessing information from filenames
5 # Copyright (c) 2011 Nicolas Wack <wackou@gmail.com>
6 #
7 # GuessIt is free software; you can redistribute it and/or modify it under
8 # the terms of the Lesser GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # GuessIt is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # Lesser GNU General Public License for more details.
16 #
17 # You should have received a copy of the Lesser GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 from guessit import slogging, episode, movie
22 import sys
23 import logging
24
25
26 if __name__ == '__main__':
27     slogging.setupLogging()
28     logging.getLogger('guessit').setLevel(logging.DEBUG)
29
30     if True:
31         testeps = [ 'Series/Californication/Season 2/Californication.2x05.Vaginatown.HDTV.XviD-0TV.[tvu.org.ru].avi',
32                     'Series/dexter/Dexter.5x02.Hello,.Bandit.ENG.-.sub.FR.HDTV.XviD-AlFleNi-TeaM.[tvu.org.ru].avi',
33                     'Series/Treme/Treme.1x03.Right.Place,.Wrong.Time.HDTV.XviD-NoTV.[tvu.org.ru].avi',
34                     'Series/Duckman/Duckman - 101 (01) - 20021107 - I, Duckman.avi',
35                     'Series/Duckman/Duckman - S1E13 Joking The Chicken (unedited).avi',
36                     'Series/Simpsons/The_simpsons_s13e18_-_i_am_furious_yellow.mpg',
37                     'Series/Simpsons/Saison 12 Fran├žais/Simpsons,.The.12x08.A.Bas.Le.Sergent.Skinner.FR.[tvu.org.ru].avi',
38                     'Series/Dr._Slump_-_002_DVB-Rip_Catalan_by_kelf.avi',
39                     'Series/Kaamelott/Kaamelott - Livre V - Second Volet - HD 704x396 Xvid 2 pass - Son 5.1 - TntRip by Slurm.avi'
40                     ]
41
42         for f in testeps:
43             print '-'*80
44             print 'For:', f
45             result = episode.guess_episode_filename(f).to_json()
46             print 'Found:', result
47
48
49     if False:
50         testmovies = [ 'Movies/Fear and Loathing in Las Vegas (1998)/Fear.and.Loathing.in.Las.Vegas.720p.HDDVD.DTS.x264-ESiR.mkv',
51                        'Movies/El Dia de la Bestia (1995)/El.dia.de.la.bestia.DVDrip.Spanish.DivX.by.Artik[SEDG].avi',
52                        'Movies/Blade Runner (1982)/Blade.Runner.(1982).(Director\'s.Cut).CD1.DVDRip.XviD.AC3-WAF.avi',
53                        'Movies/Dark City (1998)/Dark.City.(1998).DC.BDRip.720p.DTS.X264-CHD.mkv',
54                        'Movies/Sin City (BluRay) (2005)/Sin.City.2005.BDRip.720p.x264.AC3-SEPTiC.mkv',
55                        'Movies/Borat (2006)/Borat.(2006).R5.PROPER.REPACK.DVDRip.XviD-PUKKA.avi', # FIXME: PROPER and R5 get overwritten
56                        '[XCT].Le.Prestige.(The.Prestige).DVDRip.[x264.HP.He-Aac.{Fr-Eng}.St{Fr-Eng}.Chaps].mkv', # FIXME: title gets overwritten
57                        'Battle Royale (2000)/Battle.Royale.(Batoru.Rowaiaru).(2000).(Special.Edition).CD1of2.DVDRiP.XviD-[ZeaL].avi'
58                        ]
59
60         for f in testmovies:
61             print '-'*80
62             print 'For:', f
63             result = movie.guess_movie_filename(f).to_json()
64             print 'Found:', result