Exemplo n.º 1
0
def nameCheck(name,dirname):
                
         # Check here from the name if this is a series or not
                p = re.compile('[-._ \\/]sample[-._ \\/]', re.I)
                m = p.search(name)
                if m:
                        print 'm:' + name.encode("utf-8")
                        return None,None
                else:
                        pass
                myParser= guess_series(name)
                
                #xbmcgui.Dialog().ok('ok')
                if myParser:
                        myParser.parse()
                        show_name= myParser.name
                        episode= str(myParser.episode).zfill(2)
                        
                        season = str(myParser.season).zfill(2)
                        show_path = os.path.join(TV_SHOWS_PATH, CleanFileName(show_name, False))
                        CreateDirectory(show_path)		
                        season_path = os.path.join(show_path, season)
                        CreateDirectory(season_path)
                        show_full = show_name + ' S' + season + 'E' + str(episode)
                        return show_full,season_path
                        

                else:
                        parser = MovieParser()
                        parser.data = name
                        parser.parse()
                        myName = parser.name 
                        myYear = parser.year
                        myotherspath = os.path.join(OTHERS_PATH, dirname)
                        print 'myName=' + myName.encode("utf-8")
                        print 'Year=' + str(myYear)
                        if myName:
                                        print 'my name exists'
                                        if myYear:
                                                print 'myyear exists'
                                                myquality = parser.quality
                                                movie_name = myName + ' (' + str(myYear) + ') ' + myquality
                                                dirname = CleanFileName(dirname,False)
                                                mydir= os.path.join(MOVIES_PATH , myquality)
                                                print 'name =' + name.encode("utf-8")
                                                print 'myquality=' + myquality
                                                if myquality=="xyz":
                                                        CreateDirectory(myotherspath)
                                                        return movie_name,myotherspath
                                                else:
                                                        print 'Movie Dir being created'
                                                        CreateDirectory(mydir)
                                                        return movie_name,mydir
                                                
                                        else:
                                                print name.encode("utf-8")
                                                CreateDirectory(myotherspath)
                                                return myName,myotherspath
                        return None,None
Exemplo n.º 2
0
def nameCheck2(name):
                print 'oldname=' + name.encode("utf8")
                name = name.replace('[ www.Speed.Cd ] - ','')
                name = name.replace('[ UsaBit.com ] - ','')
                print 'newname=' + name.encode("utf8")
         # Check here from the name if this is a series or not
                myParser= guess_series(name)
                
                #xbmcgui.Dialog().ok('ok')
                if myParser:
                        print 'Show'
                        myParser.parse()
                        show_name= myParser.name
                        episode= str(myParser.episode).zfill(2)
                        season = str(myParser.season).zfill(2)
                        show_path = os.path.join(TV_SHOWS_PATH, CleanFileName(show_name, False))
                        CreateDirectory(show_path)		
                        season_path = os.path.join(show_path, season)
                        CreateDirectory(season_path)
                        show_full = show_name + ' S' + season + 'E' + str(episode)
                        return season_path
                        

                else:
                        parser = MovieParser()
                        parser.data = name
                        parser.parse()
                        myName = parser.name 
                        myYear = parser.year
                        myotherspath = os.path.join(OTHERS_PATH, CleanFileName(name,False))
                        print 'myName=' + myName.encode("utf-8")
                        print 'Year=' + str(myYear)
                        if myName:
                                        print 'my name exists'
                                        if myYear:
                                                print 'myyear exists'
                                                myquality = parser.quality
                                                movie_name = myName + ' (' + str(myYear) + ')'
                                                mydir= os.path.join(MOVIES_PATH , myquality ,movie_name)
                                                print 'name =' + name.encode("utf-8")
                                                print 'myquality=' + myquality
                                                if myquality=="xyz":
                                                        CreateDirectory(myotherspath)
                                                        return myotherspath
                                                else:
                                                        print 'Movie Dir being created'
                                                        CreateDirectory(mydir)
                                                        return mydir
                                                
                                        else:
                                                print name.encode("utf-8")
                                                CreateDirectory(myotherspath)
                                                return myotherspath
                        return None