예제 #1
0
파일: console.py 프로젝트: rrfenton/Ice
 def roms_directory(self):
     """
     Should return a directory with a decent name for each console, such as
     C:\Users\Scott\Documents\ROMs\N64
     or
     C:\Users\Scott\Documents\ROMs\PS2
     """
     return os.path.join(filesystem_helper.roms_directory(), self.shortname)
예제 #2
0
파일: console.py 프로젝트: rrfenton/Ice
 def roms_directory(self):
     """
     Should return a directory with a decent name for each console, such as
     C:\Users\Scott\Documents\ROMs\N64
     or
     C:\Users\Scott\Documents\ROMs\PS2
     """
     return os.path.join(filesystem_helper.roms_directory(),self.shortname)
예제 #3
0
 def test_roms_directory(self):
     """
     The ROMs directory for a console should be the ROMs directory from
     filesystem_helper, except the directory name should be equal to the
     shortname for the console
     """
     gba_dir = self.console.roms_directory()
     self.assertEqual(os.path.dirname(gba_dir),filesystem_helper.roms_directory())
     self.assertEqual(os.path.basename(gba_dir),self.console.shortname)
예제 #4
0
파일: console_tests.py 프로젝트: jzerbe/Ice
 def test_roms_directory(self):
     """
     The ROMs directory for a console should be the ROMs directory from
     filesystem_helper, except the directory name should be equal to the
     shortname for the console
     """
     gba_dir = self.console.roms_directory()
     self.assertEqual(os.path.dirname(gba_dir),
                      filesystem_helper.roms_directory())
     self.assertEqual(os.path.basename(gba_dir), self.console.shortname)
예제 #5
0
파일: rom_manager.py 프로젝트: PiotrWpl/Ice
 def __is_managed_by_ice__(self,shortcut):
     """
     We determine whether a shortcut is managed by ice by whether the app
     directory location is contained in the target string. The way I see it,
     a target that uses Ice will either point to an emulator (which is
     contained in the app dir), or to an Ice exectuable (again, contained
     in the Ice dir). Obviously if we add a method of executing roms which
     doesn't involve the app dir, this method will need to be rethought.
     """
     return filesystem_helper.roms_directory() in shortcut.exe
예제 #6
0
파일: console.py 프로젝트: Thermionix/Ice
    def roms_directory(self):
        """
        If the user has specified a ROMs directory in consoles.txt and it is
        accessible to Ice, returns that.

        Otherwise, appends the shortname of the console to the default ROMs
        directory given by config.txt.
        """
        if self.custom_roms_directory:
            return self.custom_roms_directory
        return os.path.join(filesystem_helper.roms_directory(),self.shortname)
예제 #7
0
파일: console.py 프로젝트: jzerbe/Ice
    def roms_directory(self):
        """
        If the user has specified a ROMs directory in consoles.txt and it is
        accessible to Ice, returns that.

        Otherwise, appends the shortname of the console to the default ROMs
        directory given by config.txt.
        """
        if self.custom_roms_directory:
            return self.custom_roms_directory
        return os.path.join(filesystem_helper.roms_directory(),self.shortname)
예제 #8
0
파일: gui.py 프로젝트: PiotrWpl/Ice
 def startIce(self):
     # very similar to the one in ice.py
     try:
         if steam_is_running():
             log_both("Ice cannot be run while Steam is open. Please close Steam and try again")
             return
         log_both("=========================Starting Ice")
         fs.create_directory_if_needed(fs.roms_directory(), log="Creating ROMs directory at %s" % fs.roms_directory())
         # Find all of the ROMs that are currently in the designated folders
         roms = console.find_all_roms()
         # Find the Steam Account that the user would like to add ROMs for
         user_ids = steam_user_manager.user_ids_on_this_machine()
         grid_manager = IceGridImageManager()
         for user_id in user_ids:
             log_both("---------------Running for user %s" % str(user_id))
             # Load their shortcuts into a SteamShortcutManager object
             shortcuts_path = steam_user_manager.shortcuts_file_for_user_id(user_id)
             shortcuts_manager = SteamShortcutManager(shortcuts_path)
             rom_manager = IceROMManager(shortcuts_manager)
             # Add the new ROMs in each folder to our Shortcut Manager
             rom_manager.sync_roms(roms)
             # Generate a new shortcuts.vdf file with all of the new additions
             shortcuts_manager.save()
             if IceGridImageManager.should_download_images():
                 log_both("---Downloading grid images")
                 grid_manager.update_user_images(user_id,roms)
             else:
                 log_both("Skipping 'Download Image' step")
         log_both("=========================Finished")
     except ConfigError as error:
         log_user("=========================Stopping\n")
         log_config_error(error)
         log_exception()
         log_file("!!!")
     except StandardError as error:
         log_both("####################################")
         log_both("An Error has occurred:")
         log_both(error)
         log_exception()
         log_both("####################################")
예제 #9
0
파일: gui.py 프로젝트: jzerbe/Ice
 def startIce(self):
     # very similar to the one in ice.py
     try:
         if steam_is_running():
             ice_logger.log_error("Ice cannot be run while Steam is open. Please close Steam and try again")
             return
         ice_logger.log("Starting Ice")
         fs.create_directory_if_needed(fs.roms_directory(), log="Creating ROMs directory at %s" % fs.roms_directory())
         # Find all of the ROMs that are currently in the designated folders
         roms = console.find_all_roms()
         # Find the Steam Account that the user would like to add ROMs for
         user_ids = steam_user_manager.user_ids_on_this_machine()
         grid_manager = IceGridImageManager()
         for user_id in user_ids:
             ice_logger.log("Running for user %s" % str(user_id))
             # Load their shortcuts into a SteamShortcutManager object
             shortcuts_path = steam_user_manager.shortcuts_file_for_user_id(user_id)
             shortcuts_manager = SteamShortcutManager(shortcuts_path)
             rom_manager = IceROMManager(shortcuts_manager)
             # Add the new ROMs in each folder to our Shortcut Manager
             rom_manager.sync_roms(roms)
             # Generate a new shortcuts.vdf file with all of the new additions
             shortcuts_manager.save()
             if IceGridImageManager.should_download_images():
                 ice_logger.log("Downloading grid images")
                 grid_manager.update_user_images(user_id,roms)
             else:
                 ice_logger.log("Skipping 'Download Image' step")
         ice_logger.log("Finished")
     except ConfigError as error:
         ice_logger.log_error('Stopping')
         ice_logger.log_config_error(error)
         ice_logger.log_exception()
     except StandardError as error:
         ice_logger.log_error("An Error has occurred:")
         ice_logger.log_exception()
예제 #10
0
Functionality should be added to this class if it involves the interaction
between ROMs and Steam Shortcuts.
"""

import sys
import os

import filesystem_helper
import steam_user_manager
from ice_logging import log_both
from steam_shortcut_manager import SteamShortcutManager, SteamShortcut
from steam_grid import SteamGrid

# Check to see if the directory we are going to use to Store ROMs exists. If it
# does not, then create it.
if not os.path.exists(filesystem_helper.roms_directory()):
    os.makedirs(filesystem_helper.roms_directory())


class IceROMManager():
    def __init__(self, shortcut_manager):
        """
        Takes an already initialized SteamShortcutsManager. Then does a O(n)
        computation to figure out which ROMs from Ice are already present and
        caches that result. That way, adding a ROM to the SteamShortcutsManager
        can be a O(1) lookup to see if the ROM is already managed, and a O(1)
        addition to the list (if it does not exist)
        
        Stores the managed ROMs in a set to optimize time complexity. See
        http://wiki.python.org/moin/TimeComplexity
        for details
예제 #11
0
파일: rom_manager.py 프로젝트: rrfenton/Ice
Functionality should be added to this class if it involves the interaction
between ROMs and Steam Shortcuts.
"""

import sys
import os

import filesystem_helper
import steam_user_manager
from ice_logging import log_both
from steam_shortcut_manager import SteamShortcutManager,SteamShortcut
from steam_grid import SteamGrid

# Check to see if the directory we are going to use to Store ROMs exists. If it
# does not, then create it.
if not os.path.exists(filesystem_helper.roms_directory()):
    os.makedirs(filesystem_helper.roms_directory())

class IceROMManager():
    def __init__(self,shortcut_manager):
        """
        Takes an already initialized SteamShortcutsManager. Then does a O(n)
        computation to figure out which ROMs from Ice are already present and
        caches that result. That way, adding a ROM to the SteamShortcutsManager
        can be a O(1) lookup to see if the ROM is already managed, and a O(1)
        addition to the list (if it does not exist)
        
        Stores the managed ROMs in a set to optimize time complexity. See
        http://wiki.python.org/moin/TimeComplexity
        for details
        """
예제 #12
0
파일: rom_manager.py 프로젝트: castrojo/Ice
Functionality should be added to this class if it involves the interaction
between ROMs and Steam Shortcuts.
"""

import sys
import os

import filesystem_helper
import steam_user_manager
from ice_logging import log_both
from steam_shortcut_manager import SteamShortcutManager,SteamShortcut
from steam_grid import SteamGrid

# Check to see if the directory we are going to use to Store ROMs exists. If it
# does not, then create it.
roms_dir = filesystem_helper.roms_directory()
if not os.path.exists(roms_dir):
    log_both("Creating ROMs directory at %s" % roms_dir)
    os.makedirs(roms_dir)

class IceROMManager():
    def __init__(self,shortcut_manager):
        """
        Takes an already initialized SteamShortcutsManager. Then does a O(n)
        computation to figure out which ROMs from Ice are already present and
        caches that result. That way, adding a ROM to the SteamShortcutsManager
        can be a O(1) lookup to see if the ROM is already managed, and a O(1)
        addition to the list (if it does not exist)
        
        Stores the managed ROMs in a set to optimize time complexity. See
        http://wiki.python.org/moin/TimeComplexity