Ejemplo n.º 1
0
def _tuneup_config(config):
    config['__xvmVersion'] = XVM.XVM_VERSION
    config['__wotVersion'] = XVM.WOT_VERSION
    config['__xvmIntro'] = XVM.XVM_INTRO
    config['__wgApiAvailable'] = GAME_REGION in xfw_constants.URLS.WG_API_SERVERS

    config['battle']['clanIconsFolder'] = utils.fixPath(config['battle']['clanIconsFolder'])

    config['iconset']['battleLoadingAlly']  = utils.fixPath(config['iconset']['battleLoadingAlly'])
    config['iconset']['battleLoadingEnemy'] = utils.fixPath(config['iconset']['battleLoadingEnemy'])
    config['iconset']['playersPanelAlly']   = utils.fixPath(config['iconset']['playersPanelAlly'])
    config['iconset']['playersPanelEnemy']  = utils.fixPath(config['iconset']['playersPanelEnemy'])
    config['iconset']['statisticFormAlly']  = utils.fixPath(config['iconset']['statisticFormAlly'])
    config['iconset']['statisticFormEnemy'] = utils.fixPath(config['iconset']['statisticFormEnemy'])
    config['iconset']['vehicleMarkerAlly']  = utils.fixPath(config['iconset']['vehicleMarkerAlly'])
    config['iconset']['vehicleMarkerEnemy'] = utils.fixPath(config['iconset']['vehicleMarkerEnemy'])

    if config['battleLoading']['clanIcon']['xr'] is None:
        config['battleLoading']['clanIcon']['xr'] = config['battleLoading']['clanIcon']['x']
    if config['battleLoading']['clanIcon']['yr'] is None:
        config['battleLoading']['clanIcon']['yr'] = config['battleLoading']['clanIcon']['y']
    if config['statisticForm']['clanIcon']['xr'] is None:
        config['statisticForm']['clanIcon']['xr'] = config['statisticForm']['clanIcon']['x']
    if config['statisticForm']['clanIcon']['yr'] is None:
        config['statisticForm']['clanIcon']['yr'] = config['statisticForm']['clanIcon']['y']
    if config['playersPanel']['clanIcon']['xr'] is None:
        config['playersPanel']['clanIcon']['xr'] = config['playersPanel']['clanIcon']['x']
    if config['playersPanel']['clanIcon']['yr'] is None:
        config['playersPanel']['clanIcon']['yr'] = config['playersPanel']['clanIcon']['y']
Ejemplo n.º 2
0
def download_track(track):
    download_dir = settings.getSetting('folder')
    downloaded, path, folder = getTrackPath(download_dir, track, codec)
    if not downloaded:
        checkFolder(folder)
        info = get_track_download_info(track, codec, high_res)
        log("download: %s, %s" % (info.codec, info.bitrate_in_kbps))
        info.download(fixPath(path))
        if codec == "mp3":
            audio = mp3.MP3(path, ID3=easyid3.EasyID3)
            audio["title"] = track.title
            audio["length"] = str(track.duration_ms)
            if track.artists:
                audio["artist"] = track.artists[0].name
            if track.albums:
                audio["album"] = track.albums[0].title
                audio["tracknumber"] = str(
                    track.albums[0].track_position.index)
                audio["date"] = str(track.albums[0].year)
                audio["genre"] = track.albums[0].genre
            audio.save()
        elif codec == "aac":
            log("TODO: add tags to aac files")
    # notify("Download", "Done: %s" % path, 1)
    return path
Ejemplo n.º 3
0
    def askPath(self):
        cPath = None
        while True:
            path = input(
                "Paste an absolute path to your picture e.g. /home/igor/Pictures/1.jpg (you can drag it onto this windows, but NO 'QUOTES' OR SPACES ALLOWED)\n"
            )

            if utils.pathIsBroken(path): cPath = utils.fixPath(path)
            #call autocorrect if its somehow broken

            if cPath is not None:
                #if it had to be changed
                print(
                    "\n\nIt looks like your path has some illegal attributes\nlike 'quotes' or spaces before or after the proper path."
                )
                print("So we tried to change it.")
                print("%s => %s\n" % (path, cPath))
                if utils.askYN(
                        "Is it a valid path to your picture?(Y/n) ") is False:
                    print("\nWell... Then you have to type it again")
                    #and the loop loops around again
                else:
                    #you user agreed that this is a valid path
                    path = cPath
                    break
            else:
                #it didn't change
                break

        return path
Ejemplo n.º 4
0
 def paths_gen():
     # Search icons
     prefix = 'res_mods/mods/shared_resources/xvm/res/{}'.format(
         utils.fixPath(config.get('battle/clanIconsFolder')))
     yield '{}ID/{}.png'.format(prefix, pl.accountDBID)
     yield '{}{}/nick/{}.png'.format(prefix, GAME_REGION, pl.name)
     if hasattr(pl, 'x_emblem'):
         yield pl.x_emblem
     if pl.clan:
         yield '{}{}/clan/{}.png'.format(prefix, GAME_REGION, pl.clan)
         yield '{}{}/clan/default.png'.format(prefix, GAME_REGION)
     yield '{}{}/nick/default.png'.format(prefix, GAME_REGION)
Ejemplo n.º 5
0
 def paths_gen():
     # Search icons
     prefix = 'res_mods/mods/shared_resources/xvm/res/{}'.format(
         utils.fixPath(config.get('battle/clanIconsFolder')))
     yield '{}ID/{}.png'.format(prefix, pl.accountDBID)
     yield '{}{}/nick/{}.png'.format(prefix, GAME_REGION, pl.name)
     if hasattr(pl, 'x_emblem'):
         yield pl.x_emblem
     if pl.clan:
         yield '{}{}/clan/{}.png'.format(prefix, GAME_REGION, pl.clan)
         yield '{}{}/clan/default.png'.format(prefix, GAME_REGION)
     yield '{}{}/nick/default.png'.format(prefix, GAME_REGION)
Ejemplo n.º 6
0
 def close(self):
     """Close current file stream."""
     self._csvFile.close()
     self._filesWritten.append(fixPath(self._csvFileName))
Ejemplo n.º 7
0
SAMPLES_PER_EPOCH = (20000//BATCH_SIZE)*BATCH_SIZE
IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS = 66, 200, 3
INPUT_SHAPE = (IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS)
############################

# Reading from the clean csv after the path fixing
# Note that custom collected data is joined with
# the udacity data
base_path = '/Users/mohammedamarnah/Desktop/SDCProject/dataset/'
paths = glob.glob(base_path+'*')

app = False
for i in range(len(paths)):
	if paths[i][-1] == '2':
		continue
	utils.fixPath(paths[i]+'/IMG/', paths[i]+'/', append=app)
	app = True

data = pd.read_csv('../../dataset/data/driving_log_clean.csv')

# Shuffling the data
data = data.sample(frac=1).reset_index(drop=True)

# Reading the data from the pandas dataframe
X = data[['center', 'left', 'right']].values
y = data['steering'].values

# Balancing the dataset, and dropping some of the common examples
X, y = utils.balance_data(X, y)

# Some information about the data after balancing
Ejemplo n.º 8
0
SPLIT = 0.7
BATCH_SIZE = 40
EPOCHS = 30
SAMPLES_PER_EPOCH = (20000 // BATCH_SIZE) * BATCH_SIZE
IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS = 66, 200, 3
INPUT_SHAPE = (IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS)
############################

# Reading from the clean csv after the path fixing
# Note that custom collected data is joined with
# the udacity data
path1 = '/Users/mohammedamarnah/Desktop/SDCProject/data/IMG/'
path2 = '/Users/mohammedamarnah/Desktop/SDCProject/custom-data/IMG/'
path3 = '/Users/mohammedamarnah/Desktop/SDCProject/custom-data-2/IMG/'
path4 = '/Users/mohammedamarnah/Desktop/SDCProject/custom-data-3/IMG/'
utils.fixPath(path1, '../../data', append=False)
utils.fixPath(path2, '../../custom-data', append=True)
utils.fixPath(path3, '../../custom-data-2', append=True)
utils.fixPath(path4, '../../custom-data-3', append=True)

data = pd.read_csv('../../data/driving_log_clean.csv')

# Shuffling the data
data = data.sample(frac=1).reset_index(drop=True)

# Dropping some of the data to balance the dataset
bad = 0
for index1, row1 in data.iterrows():
    if row1['steering'] == 0:
        bad += 1
ind = []
Ejemplo n.º 9
0
 def close(self):
     '''Close current file stream.'''
     self._csvFile.close()
     self._filesWritten.append(fixPath(self._csvFileName))