def handle(self, *args, **options):

        soundtracks = (
            'Legend of Zelda: Skyward Sword',
            'Legend of Zelda: Twilight Princess',
            'Legend of Zelda: Wind Waker',
            'Legend of Zelda: Majora\'s Mask',
            'Legend of Zelda: Majora\'s Mask Orchestrated',
            'Legend of Zelda: Ocarina of Time',
            'Legend of Zelda: Ocarina of Time Orchestrated',
            'Legend of Zelda: Ocarina of Time Rearranged',
            'Super Mario Galaxy',
            'Super Mario 64',
            'Earthbound',
            'Grim Fandango',
            'Katamari Damacy',
        )

        Soundtrack.objects.all().delete()

        for title in soundtracks:

            filename = title_to_filename(title)
            soundtrack_path = path.join(settings.STATIC_ROOT, 'soundtracks', filename)
            soundtrack = Soundtrack(title=title, filename=filename)
            soundtrack.save()
            for song in glob(path.join(soundtrack_path, '*.mp3')):
                song_url = path.join(settings.STATIC_URL, 'soundtracks', soundtrack.filename, path.basename(song))
                title = EasyID3(song)['title'][0]
                Song(url=song_url, title=title, soundtrack=soundtrack).save()
            zip_filename = path.join(soundtrack_path, 'all.zip')
            zip_files = glob(path.join(soundtrack_path, '*.mp3'))
            zip(zip_filename, zip_files)
Beispiel #2
0
    def handle(self, *args, **options):

        SheetGroup.objects.all().delete()

        groups = open(
            path.join(settings.TEMPLATE_DIRS[0], 'lists', 'sheets.txt'),
            'r').read().split('\n\n\n')
        for group in groups:
            sheets = group.split('\n')
            group = SheetGroup(title=sheets[0],
                               filename=title_to_filename(sheets[0]))
            group.save()
            group_path = path.join(settings.STATIC_ROOT, 'sheets',
                                   group.filename)
            sheets = sheets[2:]
            zips = {
                'sheets-classic': ([], '.pdf'),
                'sheets-labeled': ([], '-labels.pdf'),
                'midis': ([], '.mid'),
                'mp3s': ([], '.mp3'),
            }
            for sheet in sheets:
                title = sheet[:-4]
                filename = title_to_filename(title)
                Sheet(title=title,
                      url=path.join(group.url, filename),
                      group=group,
                      rating=sheet[-1:]).save()
                filepath = path.join(group_path, filename)
                for zip_group in zips:
                    zips[zip_group][0].append('%s%s' %
                                              (filepath, zips[zip_group][1]))

            if len(sheets) > 1:
                for zip_group in zips:
                    zip_filename = '%s.zip' % path.join(group_path, zip_group)
                    zip(zip_filename, zips[zip_group][0])
Beispiel #3
0
    def handle(self, *args, **options):

        SheetGroup.objects.all().delete()

        groups = open(path.join(settings.TEMPLATE_DIRS[0], 'lists', 'sheets.txt'), 'r').read().split('\n\n\n')
        for group in groups:
            sheets = group.split('\n')
            group = SheetGroup(
                title = sheets[0],
                filename = title_to_filename(sheets[0])
            )
            group.save()
            group_path = path.join(settings.STATIC_ROOT, 'sheets', group.filename)
            sheets = sheets[2:]
            zips = {
                'sheets-classic': ([], '.pdf'),
                'sheets-labeled': ([], '-labels.pdf'),
                'midis': ([], '.mid'),
                'mp3s': ([], '.mp3'),
            }
            for sheet in sheets:
                title = sheet[:-4]
                filename = title_to_filename(title)
                Sheet(
                    title = title,
                    url = path.join(group.url, filename),
                    group = group,
                    rating = sheet[-1:]
                ).save()
                filepath = path.join(group_path, filename)
                for zip_group in zips:
                    zips[zip_group][0].append('%s%s' % (filepath, zips[zip_group][1]))

            if len(sheets) > 1:
                for zip_group in zips:
                    zip_filename = '%s.zip' % path.join(group_path, zip_group)
                    zip(zip_filename, zips[zip_group][0])
Beispiel #4
0
def get_games_i_like():
    unprocessed_games = open(path.join(settings.TEMPLATE_DIRS[0], 'lists', 'games-i-like.txt'), 'r').read().split('\n\n')
    games = []
    for game in unprocessed_games:
        game = game.split('\n')
        amazon_link = game[3] if game[3].startswith('http') else ''
        filename = title_to_filename(game[0])
        games.append(dict(
            title = game[0],
            filename = 'seventh-guest' if filename == '7th-guest' else filename,
            platform = game[1],
            wikilink = game[2],
            amazon_link = amazon_link,
            amazon_image = game[4] if amazon_link else '',
            description = game[5:] if amazon_link else game[3:]
        ))
    return games
Beispiel #5
0
def get_games_i_like():
    unprocessed_games = open(
        path.join(settings.TEMPLATE_DIRS[0], 'lists', 'games-i-like.txt'),
        'r').read().split('\n\n')
    games = []
    for game in unprocessed_games:
        game = game.split('\n')
        amazon_link = game[3] if game[3].startswith('http') else ''
        filename = title_to_filename(game[0])
        games.append(
            dict(title=game[0],
                 filename='seventh-guest'
                 if filename == '7th-guest' else filename,
                 platform=game[1],
                 wikilink=game[2],
                 amazon_link=amazon_link,
                 amazon_image=game[4] if amazon_link else '',
                 description=game[5:] if amazon_link else game[3:]))
    return games