Skip to content

Instantly share code, notes, and snippets.

Last active Mar 30, 2018
What would you like to do?
if you never installed python or don't have panda + wget installed (python3 modules) then execute the install_dep.bat first
@echo off
WHERE python
IF NOT EXIST Anaconda3-5.0.1-Windows-x86_64.exe wget --no-check-certificate
start /wait Anaconda3-5.0.1-Windows-x86_64.exe
echo press a button if the installer closed !
IF NOT EXIST wget --no-check-certificate
pip install wget
pip install pandas
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-#
import os
import sys
import csv
from subprocess import Popen, PIPE
import pandas as pd
import wget
def exists(path):
"""Test whether a path exists. Returns False for broken symbolic links"""
st = os.stat(path)
except os.error:
return False
return True
def filewrite(var):
"""writes to the output file"""
with open("export.txt", 'a', encoding='utf-8') as f:
f.write(var + '\n')
def search_cid(file, cid2):
get the Line where the cid is located.
with open(file, 'r', encoding="utf-8") as file2:
reader = csv.reader(file2)
for i, row in enumerate(reader):
for column in enumerate(row):
if cid2 in column:
return i, cid2
return None, cid2
def nonpdrm(link1, link2, link3, link4):
create the 4 CSV Files needed for next step
def syscmd(cmd):
executes the given command with a better way than using
os.system() (I don't know why but it seems to be bad practice !)
It also returns the exe output instead of printing it :)
cmoa = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
output, error = cmoa.communicate()
return output, error
def download(urllink, filename):
download function....
""", filename)
def database(link1, link2, link3, link4):
I know that isn't intended this way but it's easier lol
download(link1, "data_0.tsv")
download(link2, "data_1.tsv")
download(link3, "data_2.tsv")
download(link4, "data_3.tsv")
# convert the tsv's to csv's
syscmd('cat data_0.tsv | tr "\\t" "," > data_0.csv')
syscmd('cat data_1.tsv | tr "\\t" "," > data_1.csv')
syscmd('cat data_2.tsv | tr "\\t" "," > data_2.csv')
syscmd('cat data_3.tsv | tr "\\t" "," > data_3.csv')
# remove old files
return None
database(link1, link2, link3, link4)
def database_cleanup():
cleanup <3
return None
# these files can cause problems if they still/already exist !
# I know it looks beautiful XD
if exists("export.txt") is True:
if exists("data_0.csv") is True:
if exists("data_0.tsv") is True:
if exists("data_1.csv") is True:
if exists("data_1.tsv") is True:
if exists("data_2.csv") is True:
if exists("data_2.tsv") is True:
if exists("data_3.csv") is True:
if exists("data_3.tsv") is True:
# Stuff to do before:
if exists("psdle.csv") is False:
sys.exit("Please rename your psdle file to 'psdle.csv' and put it in the same directory !")
# gets user input
region = input("Please enter your Region (Region-Codes: USA, EU, JP, ASIA): ")
download_games = input("Enter Link from 'README 2.0' to the TSV File for Games: ")
download_dlc = input("Enter Link from 'README 2.0' to the TSV File for DLCs: ")
download_theme = input("Enter Link from 'README 2.0' to the TSV File for Themes: ")
vita_psm = input("Enter Link from 'README 2.0' to the TSV File for PSM: ")
# if you want to skip it replace the input(...) with the Url that you normally paste in cmd (looks like this):
# download_games = ""
df = pd.read_csv("psdle.csv", skipinitialspace=False, header=None, skiprows=1)
name = df[0].tolist()
link = df[1].tolist()
cid = df[2].tolist()
size = df[3].tolist()
# removes last entry from list (not needed) (it's the column name)
del name[-1]
del link[-1]
del cid[-1]
del size[-1]
nonpdrm(download_games, download_dlc, download_theme, vita_psm)
# checks all tabs/databases for the cid...
# is problematic if the cid exists and for example the link is missing O.O
for element in cid:
line, cid3 = search_cid("data_0.csv", element)
if line is None:
line, cid3 = search_cid("data_1.csv", cid3)
if line is None:
line, cid3 = search_cid("data_2.csv", cid3)
if line is None:
line, cid3 = search_cid("data_3.csv", cid3)
if line is None:
position = cid.index(cid3)
val = "PSV" + ', ' + region + ', ' + name[position] + ", " + link[position] + ", " + "MISSING" + ", " + cid3
print("\n\nFinished, you can now add to the PUBLIC File from the export.txt")
Copy link

TheRadziu commented Dec 2, 2017

nice! Added it to the readme 2.0. Can you add optional sha256 to it as well ?
And ps3 support, because as far as I can see it only generates output for vita

Copy link

catchra commented Mar 13, 2018

Please enter your Region (Region-Codes: USA, EU, JP, ASIA): JP
Enter Link from 'README 2.0' to the TSV File for Games:
Enter Link from 'README 2.0' to the TSV File for DLCs:
Enter Link from 'README 2.0' to the TSV File for Themes:
Enter Link from 'README 2.0' to the TSV File for PSM:
100% [............................................................................] 202992 / 202992Traceback (most recent call last):
  File "X:\psdle\", line 140, in <module>
    line, cid3 = search_cid("data_0.csv", element)
  File "X:\psdle\", line 27, in search_cid
    with open(file, 'r', encoding="utf-8") as file2:
FileNotFoundError: [Errno 2] No such file or directory: 'data_0.csv'

Copy link

dark-kota commented Mar 14, 2018

@catchra if you are using Windows, replace "cat" with "type" on line 66-69, then it'll work fine.

Copy link

catchra commented Mar 14, 2018

@dark-kota thx that fix it

Copy link

azumukupoe commented Mar 30, 2018

bat doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment