Ejemplo n.º 1
0
def copyTopLevelItems():
    # Copy top-level dune_folder template
    src = os.path.join(pydisconf.PYD_TPL_DIR, pydisconf.PYD_TL_DUFO_TPL)
    if not os.path.exists(src):
        error("Top-level dune_folder.txt template '%s' does not exist" % src)

    dst = os.path.join(pydisconf.PYD_OUT_DIR, "dune_folder.txt")
    if not os.path.exists(dst):
        PydUtil.copyTemplateFile(src, dst)
    else:
        log.info("Top-level dune_folder.txt exists, not copying ...")

    # Copy background image to top-level directory
    dst = os.path.join(pydisconf.PYD_OUT_DIR, "background.jpg")
    if not os.path.exists(dst):
        shutil.copyfile(pydisconf.PYD_BCKGR_IMAGE, dst)
        log.debug("Copied background image '%s' to '%s'" % (src, dst))
    else:
        log.info("Top-level background image exists, not copying ...")

    # Copy icon
    if not os.path.exists(pydisconf.PYD_LOGO_IMAGE):
        error("Logo image '%s' does not exist" % pydisconf.PYD_LOGO_IMAGE)
    dst = os.path.join(pydisconf.PYD_OUT_DIR, pydisconf.PYD_ICON_FILE)
    shutil.copyfile(pydisconf.PYD_LOGO_IMAGE, dst)
Ejemplo n.º 2
0
 def makeSubCategories(self, aDirPath, aSubcategories):
     
     for (name, origName, fileMask) in aSubcategories:
         fileName = self.getNameFromMask( fileMask )
         os.environ[ 'PYD_CATEGORY' ] = fileName
         os.environ[ 'PYD_CATEGORY_NAME' ] = name.encode('utf-8')
         dirPath2 = self.makeDirPath( aDirPath, fileName )
         self.makeCategory( dirPath2 )
         
         os.environ[ 'PYD_CATEGORY_DIRPATH' ] = dirPath2
         # Make icon or copy existing one
         self.makeIcons( dirPath2 )
         
         # Make 'dune_folder.txt' for sub-category
         duneFolderCatFile = os.path.join( dirPath2, 'dune_folder.txt' )
         if not os.path.exists( duneFolderCatFile ):
             PydUtil.copyTemplateFile( pydisconf.PYD_SUBCAT_DUFO_TPL, duneFolderCatFile )
         
             # Read all files for each file mask
             pathCategoryMask = os.path.join( pydisconf.PYD_YAMJ_DIR, fileMask)
             # Create list of items for given 'dune_folder.txt'
             itemList = self.makeItemList( pathCategoryMask )
             # Append list of these items to 'dune_folder.txt'
             out = open( duneFolderCatFile, 'a' )
             out.writelines( itemList )
             out.close()
             itemNum = len(itemList) / 8
             self.debug( "Added %d movie items" % itemNum )
Ejemplo n.º 3
0
 def copyDuneFolderTxt(self):
     duneFolderMovieFile = os.path.join( self.movieDirPath, 'dune_folder.txt' )
     self.duneFolderFile = duneFolderMovieFile
     # Determine which dune_folder template file to copy
     if self.movie.isSet:
         templateFile = pydisconf.PYD_MOVIESET_DUFO_TPL
     else:
         if self.movie.isTV:
             templateFile = pydisconf.PYD_TVSET_DUFO_TPL
         else:
             templateFile = pydisconf.PYD_MOVIE_DUFO_TPL
     retVal = os.path.exists( duneFolderMovieFile )
     if not retVal:
         PydUtil.copyTemplateFile( templateFile, duneFolderMovieFile )
     return retVal
Ejemplo n.º 4
0
def copyTopLevelItems():
    global log
    # Copy top-level dune_folder template
    src = os.path.join( pydisconf.PYD_TPL_DIR, pydisconf.PYD_TL_DUFO_TPL )
    if not os.path.exists( src ):
        error( "Top-level dune_folder.txt template '%s' does not exist" % src )
        
    dst = os.path.join( pydisconf.PYD_OUT_DIR, 'dune_folder.txt' )
    PydUtil.copyTemplateFile( src, dst )
    
    # Copy background image to top-level directory
    dst = os.path.join( pydisconf.PYD_OUT_DIR, 'background.jpg' )
    shutil.copyfile( pydisconf.PYD_BCKGR_IMAGE, dst )
    log.debug( "Copied background image '%s' to '%s'" % (src, dst) )
    
    # Copy icon
    if not os.path.exists( pydisconf.PYD_LOGO_IMAGE ):
        error( "Logo image '%s' does not exist" % pydisconf.PYD_LOGO_IMAGE )
    dst = os.path.join( pydisconf.PYD_OUT_DIR, pydisconf.PYD_ICON_FILE )
    shutil.copyfile( pydisconf.PYD_LOGO_IMAGE, dst )
Ejemplo n.º 5
0
 def makeTLCategories(self, aDict):
     if not aDict or aDict == {}:
         self.error( "Categories are not defined" )
         
     # Walk over top categories
     for (category, subcats) in aDict.items():
         if category == 'Library':
             dirPath = self.makeDirPath( pydisconf.PYD_OUT_DIR, category )
             self.makeCategory( dirPath )
             continue
         os.environ[ 'PYD_CATEGORY' ] = category
         os.environ[ 'PYD_CATEGORY_NAME' ] = category
         
         dirPath = self.makeDirPath( pydisconf.PYD_OUT_DIR, category)
         self.makeCategory( dirPath )
         os.environ[ 'PYD_CATEGORY_DIRPATH' ] = dirPath
         self.makeIcons( dirPath )
         
         duneFolderCatFile = os.path.join(dirPath, 'dune_folder.txt')
         if not os.path.exists( duneFolderCatFile ):
             PydUtil.copyTemplateFile( pydisconf.PYD_CAT_DUFO_TPL, duneFolderCatFile )
         
         # Walk over sub-categories
         self.makeSubCategories(dirPath, subcats)