Fix line-endings; Increase portability; Add speedtyper.py

This commit is contained in:
olari
2019-05-26 23:05:28 +03:00
parent 661a5984a3
commit 63a1b4f501
33 changed files with 1447 additions and 1341 deletions

View File

@@ -1,45 +1,46 @@
#!/usr/bin/env python3
import bs4
import sys
import os
import glob
# converts MyAnimeList's XML exports to readable (but less informative) text files.
animelists = glob.glob('animelist*.xml')
for animelist in animelists:
with open(animelist, 'r') as xml, open(animelist + '.txt', 'w') as file:
soup = bs4.BeautifulSoup(xml.read(), 'html.parser')
completed = []
ptw = []
movies = []
for anime in soup.select('anime'):
line = anime.select('series_title')[0].text + ' ' + anime.select('my_watched_episodes')[0].text + '/' + anime.select('series_episodes')[0].text + '\n'
series_type = anime.select('series_type')[0].text
status = anime.select('my_status')[0].text
if series_type == 'Movie':
movies.append(line)
continue
if status == 'Completed':
completed.append(line)
elif status == 'Plan to Watch':
ptw.append(line)
for title in completed:
file.write(title)
file.write('\n')
for title in ptw:
file.write(title)
file.write('\n')
for title in movies:
file.write(title)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import bs4
import sys
import os
import glob
# converts MyAnimeList's XML exports to readable (but less informative) text files.
animelists = glob.glob('animelist*.xml')
for animelist in animelists:
with open(animelist, 'r') as xml, open(animelist + '.txt', 'w') as file:
soup = bs4.BeautifulSoup(xml.read(), 'html.parser')
completed = []
ptw = []
movies = []
for anime in soup.select('anime'):
line = anime.select('series_title')[0].text + ' ' + anime.select('my_watched_episodes')[0].text + '/' + anime.select('series_episodes')[0].text + '\n'
series_type = anime.select('series_type')[0].text
status = anime.select('my_status')[0].text
if series_type == 'Movie':
movies.append(line)
continue
if status == 'Completed':
completed.append(line)
elif status == 'Plan to Watch':
ptw.append(line)
for title in completed:
file.write(title)
file.write('\n')
for title in ptw:
file.write(title)
file.write('\n')
for title in movies:
file.write(title)