How to use the sdv.legacy_location function in sdv

To help you get started, we’ve selected a few sdv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sketchy502 / SDV-Summary / sdv / imageDrone.py View on Github external
cur.execute(
                        sql.UPDATE_FARMHANDS,
                        (json.dumps(farmhands), farm_id)
                )

                portrait_info = json.loads(data['portrait_info'])

                partner_image = None
                partner_id = portrait_info.get('partner_id')
                if partner_id:
                    partner = next(filter(lambda f: f['UniqueMultiplayerID'] == partner_id, farmhands))
                    partner_image = Image.open(legacy_location(partner['avatar_url']))

                generateFamilyPortrait(avatar, portrait_info, partner_image=partner_image) \
                    .save(legacy_location(portrait_path), compress_level=9)

                # Minimap, Thumbnail and Main Map
                farm_data = regenerateFarmInfo(json.loads(data['farm_info']))
                generateMinimap(farm_data).save(legacy_location(farm_path), compress_level=9)

                farm = generateFarm(data['currentSeason'], farm_data)

                th = farm.resize((int(farm.width / 4), int(farm.height / 4)), Image.ANTIALIAS)
                th.save(legacy_location(thumb_path))
                farm = watermark(farm, filename='u.f.png')
                farm.save(legacy_location(map_path), compress_level=9)

                cur.execute(
                        sql.UPDATE_PLAYER_IMAGE_URLS,
                        (farm_path, avatar_path, portrait_path, map_path, thumb_path, base_path,
                         data['id'])
github Sketchy502 / SDV-Summary / sdv / migrateImageDirectory.py View on Github external
except OSError:
		pass

	try:
		connection = connect_db()
		cur = connection.cursor()

		avatar_paths = [original_avatar_path, os.path.join(base_path, url+'-a.png')]
		portrait_paths = [original_portrait_path, os.path.join(base_path, url+'-p.png')]
		farm_paths = [original_farm_path, os.path.join(base_path, url+'-f.png')]
		map_paths = [original_map_path, os.path.join(base_path, url+'-m.png')]
		thumb_paths = [original_thumb_path, os.path.join(base_path, url+'-t.png')]

		for original, new in [avatar_paths,portrait_paths,farm_paths,map_paths,thumb_paths]:
			try:
				shutil.move(legacy_location(original),legacy_location(new))
			except IOError:
				pass
		try:
			os.rmdir(legacy_location(original_base_path))
		except WindowsError:
			pass

		cur.execute('UPDATE playerinfo SET base_path = '+sqlesc+', avatar_url = '+sqlesc+', portrait_url = '+sqlesc+', farm_url = '+sqlesc+', map_url = '+sqlesc+', thumb_url = '+sqlesc+' WHERE id='+sqlesc,(base_path,avatar_paths[1],portrait_paths[1],farm_paths[1],map_paths[1],thumb_paths[1],rowid))
		connection.commit()
		return True
	except:
		return False
github Sketchy502 / SDV-Summary / sdv / imageDrone.py View on Github external
partner_id = portrait_info.get('partner_id')
                if partner_id:
                    partner = next(filter(lambda f: f['UniqueMultiplayerID'] == partner_id, farmhands))
                    partner_image = Image.open(legacy_location(partner['avatar_url']))

                generateFamilyPortrait(avatar, portrait_info, partner_image=partner_image) \
                    .save(legacy_location(portrait_path), compress_level=9)

                # Minimap, Thumbnail and Main Map
                farm_data = regenerateFarmInfo(json.loads(data['farm_info']))
                generateMinimap(farm_data).save(legacy_location(farm_path), compress_level=9)

                farm = generateFarm(data['currentSeason'], farm_data)

                th = farm.resize((int(farm.width / 4), int(farm.height / 4)), Image.ANTIALIAS)
                th.save(legacy_location(thumb_path))
                farm = watermark(farm, filename='u.f.png')
                farm.save(legacy_location(map_path), compress_level=9)

                cur.execute(
                        sql.UPDATE_PLAYER_IMAGE_URLS,
                        (farm_path, avatar_path, portrait_path, map_path, thumb_path, base_path,
                         data['id'])
                )
                db.commit()

                cur.execute(sql.DELETE_TASK, (task_id,))
                db.commit()
                records_handled += 1
        else:
            db.close()
            return time.time() - start_time, records_handled
github Sketchy502 / SDV-Summary / sdv / imageDrone.py View on Github external
)

                portrait_info = json.loads(data['portrait_info'])

                partner_image = None
                partner_id = portrait_info.get('partner_id')
                if partner_id:
                    partner = next(filter(lambda f: f['UniqueMultiplayerID'] == partner_id, farmhands))
                    partner_image = Image.open(legacy_location(partner['avatar_url']))

                generateFamilyPortrait(avatar, portrait_info, partner_image=partner_image) \
                    .save(legacy_location(portrait_path), compress_level=9)

                # Minimap, Thumbnail and Main Map
                farm_data = regenerateFarmInfo(json.loads(data['farm_info']))
                generateMinimap(farm_data).save(legacy_location(farm_path), compress_level=9)

                farm = generateFarm(data['currentSeason'], farm_data)

                th = farm.resize((int(farm.width / 4), int(farm.height / 4)), Image.ANTIALIAS)
                th.save(legacy_location(thumb_path))
                farm = watermark(farm, filename='u.f.png')
                farm.save(legacy_location(map_path), compress_level=9)

                cur.execute(
                        sql.UPDATE_PLAYER_IMAGE_URLS,
                        (farm_path, avatar_path, portrait_path, map_path, thumb_path, base_path,
                         data['id'])
                )
                db.commit()

                cur.execute(sql.DELETE_TASK, (task_id,))
github Sketchy502 / SDV-Summary / sdv / imageDrone.py View on Github external
partner = next(filter(lambda f: f['UniqueMultiplayerID'] == partner_id, farmhands))
                    partner_image = Image.open(legacy_location(partner['avatar_url']))

                generateFamilyPortrait(avatar, portrait_info, partner_image=partner_image) \
                    .save(legacy_location(portrait_path), compress_level=9)

                # Minimap, Thumbnail and Main Map
                farm_data = regenerateFarmInfo(json.loads(data['farm_info']))
                generateMinimap(farm_data).save(legacy_location(farm_path), compress_level=9)

                farm = generateFarm(data['currentSeason'], farm_data)

                th = farm.resize((int(farm.width / 4), int(farm.height / 4)), Image.ANTIALIAS)
                th.save(legacy_location(thumb_path))
                farm = watermark(farm, filename='u.f.png')
                farm.save(legacy_location(map_path), compress_level=9)

                cur.execute(
                        sql.UPDATE_PLAYER_IMAGE_URLS,
                        (farm_path, avatar_path, portrait_path, map_path, thumb_path, base_path,
                         data['id'])
                )
                db.commit()

                cur.execute(sql.DELETE_TASK, (task_id,))
                db.commit()
                records_handled += 1
        else:
            db.close()
            return time.time() - start_time, records_handled
github Sketchy502 / SDV-Summary / sdv / generateSavegame.py View on Github external
def createZip(url,name,uniqueidforthisgame,static_folder,savegame_file):
	target = os.path.join(static_folder,url+'.zip')
	folder = str(name)+'_'+str(uniqueidforthisgame)
	zf = zipfile.ZipFile(legacy_location(target),'w',compression=zipfile.ZIP_DEFLATED)
	savegamedata = zopen(legacy_location(savegame_file)).read()
	zf.writestr(os.path.join(folder,folder),savegamedata,zipfile.ZIP_DEFLATED)
	zf.writestr(os.path.join(folder,'SaveGameInfo'),genSaveGameInfo(savegamedata,True))
	zf.writestr('upload.farm_instructions.txt','Downloaded from upload.farm/'+str(url)+'\r\n\r\nTo use, extract the folder in this archive to:\r\n%APPDATA%\\StardewValley\\Saves')
	zf.close()
	return target