Added old project, half finished and in many parts. More great improvements coming soon
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
# seasonedShows
|
# *Seasoned*: an intelligent folder creater for your shows
|
||||||
seasonedShows | Your best show organizer
|
|
||||||
|
|
||||||
|
|||||||
26
addSubLanguage.py
Executable file
26
addSubLanguage.py
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-04 13:46:28
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 14:03:57
|
||||||
|
|
||||||
|
from langdetect import detect
|
||||||
|
from removeUploader import removeUploader
|
||||||
|
|
||||||
|
testFiles = ['subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv].srt',
|
||||||
|
'subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv]ENGLUISH.srt']
|
||||||
|
|
||||||
|
def detectLanguage(file):
|
||||||
|
f = open(file, 'r', encoding= 'ISO-8859-15')
|
||||||
|
language = detect(f.read())
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
return removeUploader(file)[:-3] + language + '.srt'
|
||||||
|
|
||||||
|
def addLangExtension():
|
||||||
|
for file in testFiles:
|
||||||
|
print(detectLanguage(file))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
addLangExtension()
|
||||||
19
createPastebin.py
Executable file
19
createPastebin.py
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-04 14:56:30
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 15:27:02
|
||||||
|
|
||||||
|
from pasteee import Paste
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pasteText = """Some text to paste
|
||||||
|
Some more text
|
||||||
|
Foo bar baz
|
||||||
|
"""
|
||||||
|
paste = Paste(pasteText, private=False, desc="My first paste", views=15)
|
||||||
|
print(paste)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
115
findStray.py
Executable file
115
findStray.py
Executable file
@@ -0,0 +1,115 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-04 16:50:09
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 22:15:21
|
||||||
|
|
||||||
|
import os, sqlite3, re
|
||||||
|
from fuzzywuzzy import process
|
||||||
|
from langdetect import detect
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
showDir = '/Volumes/media/tv/'
|
||||||
|
dbPath = 'shows.db'
|
||||||
|
mediaExtensions = ['mkv', 'mp4', 'avi']
|
||||||
|
subExtensions = ['srt']
|
||||||
|
|
||||||
|
def XOR(list1, list2):
|
||||||
|
return set(list1) ^ set(list2)
|
||||||
|
|
||||||
|
def getFuzzyName(query):
|
||||||
|
return process.extractOne(query, getShowNames().keys())
|
||||||
|
|
||||||
|
def removeUploader(mediaItem):
|
||||||
|
match = re.search('-[a-zA-Z\[\]\-]*.[a-z]{3}', mediaItem)
|
||||||
|
if match:
|
||||||
|
uploader, ext = match.group(0).split('.')
|
||||||
|
return uploader
|
||||||
|
|
||||||
|
return subtitles
|
||||||
|
|
||||||
|
def getLanguage(path, subtitles):
|
||||||
|
f = open(path + subtitles, 'r', encoding= 'ISO-8859-15')
|
||||||
|
language = detect(f.read())
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
return language
|
||||||
|
|
||||||
|
# Finds the correct show name
|
||||||
|
def getShowNames():
|
||||||
|
conn = sqlite3.connect(dbPath)
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
c.execute('SELECT show_names, date_added, date_modified FROM shows')
|
||||||
|
|
||||||
|
returnList = {}
|
||||||
|
for name, added, modified in c.fetchall():
|
||||||
|
returnList[name] = [added, modified]
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
return returnList
|
||||||
|
|
||||||
|
def getNewFolderContents():
|
||||||
|
showNames = getShowNames().keys()
|
||||||
|
folderContents = filter( lambda f: not f.startswith('.'), os.listdir(showDir))
|
||||||
|
|
||||||
|
return XOR(folderContents, showNames)
|
||||||
|
|
||||||
|
def checkForSingleEpisodes(folderItem):
|
||||||
|
showName, hit = getFuzzyName(folderItem)
|
||||||
|
episodeMatch = re.findall(re.sub(' ', '.', showName)+'\.S[0-9]{1,2}E[0-9]{1,2}\.', folderItem)
|
||||||
|
|
||||||
|
if episodeMatch:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def getByIdentifier(folderItem, identifier):
|
||||||
|
itemMatch = re.findall(identifier + '[0-9]{1,2}', folderItem)
|
||||||
|
item = re.sub(identifier, '', itemMatch[0])
|
||||||
|
return item
|
||||||
|
|
||||||
|
def getItemChildren(folder):
|
||||||
|
children = os.listdir(showDir + folder)
|
||||||
|
|
||||||
|
media_items = []
|
||||||
|
subtitles = []
|
||||||
|
trash = []
|
||||||
|
for childItem in children:
|
||||||
|
if childItem[-3:] in mediaExtensions:
|
||||||
|
media_items.append([childItem, removeUploader(childItem)])
|
||||||
|
elif childItem[-3:] in subExtensions:
|
||||||
|
subtitles.append([childItem, removeUploader(childItem), getLanguage(showDir + folder + '/', childItem)])
|
||||||
|
else:
|
||||||
|
trash.append(childItem)
|
||||||
|
|
||||||
|
return media_items, subtitles, trash
|
||||||
|
|
||||||
|
|
||||||
|
def getEpisodeInfo(folderItem):
|
||||||
|
showName, hit = getFuzzyName(folderItem)
|
||||||
|
season = getByIdentifier(folderItem, 'S')
|
||||||
|
episode = getByIdentifier(folderItem, 'E')
|
||||||
|
media_items, subtitles, trash = getItemChildren(folderItem)
|
||||||
|
|
||||||
|
episodeInfo = []
|
||||||
|
episodeInfo = {'original': folderItem,
|
||||||
|
'full_path': showDir + folderItem,
|
||||||
|
'name': showName,
|
||||||
|
'season': season,
|
||||||
|
'episode': episode,
|
||||||
|
'media_items': media_items,
|
||||||
|
'subtitles': subtitles,
|
||||||
|
'trash': trash}
|
||||||
|
|
||||||
|
|
||||||
|
return episodeInfo
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
for item in getNewFolderContents():
|
||||||
|
if checkForSingleEpisodes(item):
|
||||||
|
pprint(getEpisodeInfo(item))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
8
info.txt
Normal file
8
info.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
New Girl
|
||||||
|
Season 06
|
||||||
|
Episode 16
|
||||||
|
|
||||||
|
Remove author
|
||||||
|
[eztv]
|
||||||
|
jkdhdlafjkhdsalkjfh.ENGLISH.srt
|
||||||
|
- english.srt
|
||||||
57
pasteee.py
Normal file
57
pasteee.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
pasteee module
|
||||||
|
Allows pasting to https://paste.ee
|
||||||
|
https://github.com/i-ghost/pasteee
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 2 <-> 3
|
||||||
|
from urllib.request import urlopen
|
||||||
|
from urllib.request import Request as urlrequest
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
from urllib import error as urlerror
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class PasteError(Exception):
|
||||||
|
"""Exception class for this module"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Paste(object):
|
||||||
|
def __new__(cls, paste,
|
||||||
|
private=True, lang="plain",
|
||||||
|
key="public", desc="",
|
||||||
|
expire=0, views=0, encrypted=False):
|
||||||
|
if not paste:
|
||||||
|
raise PasteError("No paste provided")
|
||||||
|
if expire and views:
|
||||||
|
# API incorrectly returns success so we raise error locally
|
||||||
|
raise PasteError("Options 'expire' and 'views' are mutually exclusive")
|
||||||
|
request = urlrequest(
|
||||||
|
"http://paste.ee/api",
|
||||||
|
data=urlencode(
|
||||||
|
{
|
||||||
|
'paste': paste,
|
||||||
|
'private': bool(private),
|
||||||
|
'language': lang,
|
||||||
|
'key': key,
|
||||||
|
'description': desc,
|
||||||
|
'expire': expire,
|
||||||
|
'views': views,
|
||||||
|
'encrypted': bool(encrypted),
|
||||||
|
'format': "json"
|
||||||
|
}
|
||||||
|
).encode("utf-8"),
|
||||||
|
headers={'User-Agent': 'Mozilla/5.0'}
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
result = json.loads(urlopen(request).read().decode("utf-8"))
|
||||||
|
return result["paste"]
|
||||||
|
except urlerror.HTTPError:
|
||||||
|
print("Couldn't send paste")
|
||||||
|
raise
|
||||||
|
except KeyError:
|
||||||
|
raise PasteError("Invalid paste option: %s" % (result["error"]))
|
||||||
30
readDB.py
Executable file
30
readDB.py
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-03 22:35:38
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 11:09:09
|
||||||
|
|
||||||
|
import sqlite3
|
||||||
|
from fuzzywuzzy import process
|
||||||
|
|
||||||
|
path = "/Users/KevinMidboe/Dropbox/python/seasonedShows/shows.db"
|
||||||
|
|
||||||
|
def main():
|
||||||
|
conn = sqlite3.connect(path)
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
c.execute('SELECT show_names, date_added, date_modified FROM shows')
|
||||||
|
|
||||||
|
returnList = {}
|
||||||
|
for name, added, modified in c.fetchall():
|
||||||
|
returnList[name] = [added, modified]
|
||||||
|
|
||||||
|
while True:
|
||||||
|
query = input('Query: ')
|
||||||
|
print(process.extractOne(query, returnList.keys()))
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
main()
|
||||||
24
removeUploader.py
Executable file
24
removeUploader.py
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-04 13:47:32
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 13:53:12
|
||||||
|
|
||||||
|
import re
|
||||||
|
testFile = '/Volumes/media/tv/New Girl/New Girl Season 06/New Girl S06E18/New.Girl.S06E18.Young.Adult.1080p.WEB-DL.DD5.1.H264-[eztv]-horse.mkv'
|
||||||
|
|
||||||
|
def removeUploader(file=testFile):
|
||||||
|
match = re.search('-[a-zA-Z\[\]\-]*.[a-z]{3}', file)
|
||||||
|
|
||||||
|
if match and input('Remove uploader:\t' + match.group(0)[:-4] + ' [Y/n] ') != 'n':
|
||||||
|
uploader, ext = match.group(0).split('.')
|
||||||
|
# if ext not in subExtensions:
|
||||||
|
# file = file.replace(uploader, '')
|
||||||
|
# else:
|
||||||
|
# file = file.replace(uploader, '.eng')
|
||||||
|
file = file.replace(uploader, '')
|
||||||
|
return file
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(removeUploader())
|
||||||
252
seasonedFolders.py
Executable file
252
seasonedFolders.py
Executable file
@@ -0,0 +1,252 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-02-23 21:41:40
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 16:32:35
|
||||||
|
|
||||||
|
import os, re, shutil, sqlite3
|
||||||
|
from fuzzywuzzy import process
|
||||||
|
from sys import argv
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
# TODO Rename file to remove watermark DONE
|
||||||
|
# Look for subs in file and folder DONE
|
||||||
|
# What if there are multiple subs
|
||||||
|
# Add language for subs
|
||||||
|
# Remove stupid samples
|
||||||
|
# Import directory based on OS
|
||||||
|
|
||||||
|
# THE PARTS OF SEASONED FOLDER
|
||||||
|
# DATABASE
|
||||||
|
# Add show
|
||||||
|
# Get list of shows
|
||||||
|
# Add cmdInfoExtractor
|
||||||
|
|
||||||
|
# Parser
|
||||||
|
# Get files from directory
|
||||||
|
# Check files not in shows list
|
||||||
|
# Get best match to the name of file
|
||||||
|
# Get folder contents
|
||||||
|
|
||||||
|
# cmdInfoExtractor
|
||||||
|
# NB: Create folder for new seasons
|
||||||
|
# Folderpath
|
||||||
|
# Show match
|
||||||
|
# Episode/Season
|
||||||
|
# Contents
|
||||||
|
# mediafiles
|
||||||
|
# - removed author
|
||||||
|
# subtitles
|
||||||
|
# - removed author
|
||||||
|
#
|
||||||
|
|
||||||
|
# cmdInfoExecuter
|
||||||
|
# Checks if there is a waiting tweet
|
||||||
|
# Check for replies for the gives tweets
|
||||||
|
# If any has reply (y), execute the cmdInfo
|
||||||
|
# Delete from waiting DB and add to fixed DB
|
||||||
|
|
||||||
|
# Twitter
|
||||||
|
# twitter - [index] = en
|
||||||
|
# - [index] -
|
||||||
|
# - [index] +
|
||||||
|
# trash
|
||||||
|
# twitter - [index] +
|
||||||
|
# - [index] -
|
||||||
|
# - [index] =
|
||||||
|
|
||||||
|
showDir = '/Volumes/media/tv/'
|
||||||
|
dbPath = "/Users/KevinMidboe/Dropbox/python/seasonedShows/shows.db"
|
||||||
|
mediaExtensions = ['mkv', 'mp4', 'avi']
|
||||||
|
subExtensions = ['srt']
|
||||||
|
|
||||||
|
def verifyConnectedDirectory():
|
||||||
|
if not os.path.isdir(showDir):
|
||||||
|
print('Error:', showDir + ' folder not found. Is it mounted?')
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
def addShowToDB(name):
|
||||||
|
if name in getShowNames():
|
||||||
|
return False
|
||||||
|
|
||||||
|
conn = sqlite3.connect(dbPath)
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
c.execute('INSERT INTO shows VALUES ("' + str(name) + '"' + ", datetime('now'), datetime('now'))")
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def addSubLanguage(file):
|
||||||
|
f = open('subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv].srt', 'r', encoding = "UTF-32")
|
||||||
|
detectedLanguage = detect(f.read())
|
||||||
|
|
||||||
|
# Removes the uploader name from filename
|
||||||
|
def removeUploader(file):
|
||||||
|
match = re.search('-[a-zA-Z\[\]\-]*.[a-z]{3}', file)
|
||||||
|
|
||||||
|
if match and input('Remove uploader:\t' + match.group(0)[:-4] + ' [Y/n] ') != 'n':
|
||||||
|
uploader, ext = match.group(0).split('.')
|
||||||
|
# if ext not in subExtensions:
|
||||||
|
# file = file.replace(uploader, '')
|
||||||
|
# else:
|
||||||
|
# file = file.replace(uploader, '.eng')
|
||||||
|
file = file.replace(uploader, '')
|
||||||
|
return file
|
||||||
|
|
||||||
|
|
||||||
|
def moveEpisode(srcFile, destDir):
|
||||||
|
os.rename(srcFile, destDir)
|
||||||
|
|
||||||
|
def XOR(list1, list2):
|
||||||
|
return set(list1) ^ set(list2)
|
||||||
|
|
||||||
|
def getFuzzyNames(query):
|
||||||
|
return process.extractOne(query, getShowNames().keys())
|
||||||
|
|
||||||
|
# Finds the correct show name
|
||||||
|
def getShowNames():
|
||||||
|
conn = sqlite3.connect(dbPath)
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
c.execute('SELECT show_names, date_added, date_modified FROM shows')
|
||||||
|
|
||||||
|
returnList = {}
|
||||||
|
for name, added, modified in c.fetchall():
|
||||||
|
returnList[name] = [added, modified]
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
return returnList
|
||||||
|
|
||||||
|
# showList = os.listdir(showDir) # Get's list of folders in showDir
|
||||||
|
|
||||||
|
# return process.extractOne(input, showList)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getSeasons(show):
|
||||||
|
existingShowSeasons = os.listdir(showDir + show)
|
||||||
|
|
||||||
|
seasonsList = []
|
||||||
|
for season in existingShowSeasons:
|
||||||
|
# Checks if folder is given format (Season [0-9]{2}$)
|
||||||
|
if re.search('Season\ [0-9]{2}$', season):
|
||||||
|
# If re finds a match we append the season folder to seasonsList[]
|
||||||
|
seasonsList.append(season[-2:])
|
||||||
|
|
||||||
|
# TODO Return full season name and create list in the if statement at return'
|
||||||
|
return seasonsList
|
||||||
|
|
||||||
|
|
||||||
|
def createEpisodeFolders(show, season, episode, createNew=False):
|
||||||
|
episodeFormat = '%s S%sE'% (show, season)
|
||||||
|
seasonFormat = '%s Season %s/' % (show, season)
|
||||||
|
|
||||||
|
seasonDir = showDir + show + '/' + seasonFormat
|
||||||
|
|
||||||
|
# Creates a season folder if none exists for given season value
|
||||||
|
if createNew == True:
|
||||||
|
os.makedirs(seasonDir)
|
||||||
|
|
||||||
|
episodeList = os.listdir(seasonDir)
|
||||||
|
|
||||||
|
for i in range(1,int(episode)+1):
|
||||||
|
i_formatted = '{:02}'.format(i)
|
||||||
|
if episodeFormat + i_formatted not in episodeList:
|
||||||
|
os.makedirs(seasonDir + episodeFormat + i_formatted)
|
||||||
|
print(' ' + episodeFormat + i_formatted)
|
||||||
|
|
||||||
|
|
||||||
|
# TODO to only get the stray files.
|
||||||
|
# Get all folders without spaces and atleast one '.'
|
||||||
|
def findStray():
|
||||||
|
showNames = getShowNames().keys()
|
||||||
|
folderContents = filter( lambda f: not f.startswith('.'), os.listdir(showDir))
|
||||||
|
|
||||||
|
XORContent = XOR(folderContents, showNames)
|
||||||
|
|
||||||
|
multipleEpisodeRegex = 'complete|season|\.\S[0-9]{1,2}\.'
|
||||||
|
|
||||||
|
# print(set(folderContents) ^ set(showNames))
|
||||||
|
|
||||||
|
for file in XORContent:
|
||||||
|
if re.findall(multipleEpisodeRegex, file.lower()):
|
||||||
|
print(file, process.extractOne(file, showNames))
|
||||||
|
|
||||||
|
|
||||||
|
def findStrayEpisodes(show, season, episode):
|
||||||
|
showList = os.listdir(showDir)
|
||||||
|
|
||||||
|
singleEpisodeRegex = re.sub(' ', '.', show) + '.S' + season + 'E'
|
||||||
|
# Complete season folder : Show + Season | Complete + first(number after show)
|
||||||
|
multipleEpisodeRegex = 'complete|season'
|
||||||
|
|
||||||
|
for file in showList:
|
||||||
|
if re.findall(multipleEpisodeRegex, file.lower()) and show in file:
|
||||||
|
print(file)
|
||||||
|
|
||||||
|
if singleEpisodeRegex in file:
|
||||||
|
episodeNumber = int(file[len(singleEpisodeRegex):len(singleEpisodeRegex)+2])
|
||||||
|
|
||||||
|
folderContents = os.listdir(showDir + file)
|
||||||
|
|
||||||
|
for item in folderContents:
|
||||||
|
if (item[-3:] in subExtensions or item[-3:] in mediaExtensions) and \
|
||||||
|
(episodeNumber in list(range(1, int(episode) + 1))):
|
||||||
|
fileDir = showDir + file + '/' + item
|
||||||
|
print(item)
|
||||||
|
item = removeUploader(item)
|
||||||
|
episodeFolderDir = showDir + show + '/' + show + ' Season ' + season + '/' + \
|
||||||
|
show + ' S' + season + 'E' + '{:02}'.format(episodeNumber) + '/'
|
||||||
|
|
||||||
|
moveEpisode(fileDir, episodeFolderDir + item)
|
||||||
|
|
||||||
|
pprint(os.listdir(showDir + file))
|
||||||
|
if input('Remove contents? [Y/n] ') != 'n':
|
||||||
|
shutil.rmtree(showDir + file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def parse(show, season, episode):
|
||||||
|
verifyConnectedDirectory()
|
||||||
|
|
||||||
|
show, fuzzyHit = getShowNames(show)
|
||||||
|
if fuzzyHit != 100:
|
||||||
|
if (input('Did you mean:\t' + show + ' [Y/n] ') == 'n'):
|
||||||
|
parse(input('Show query: '), season, episode)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
foundSeasons = getSeasons(show)
|
||||||
|
if season not in foundSeasons:
|
||||||
|
if (input('Create season:\t' + season + ' [Y/n] ') == 'n'):
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
createEpisodeFolders(show, season, episode, True)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
createEpisodeFolders(show, season, episode)
|
||||||
|
findStrayEpisodes(show, season, episode)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print(addShowToDB('Pokemon GO'))
|
||||||
|
exit(0)
|
||||||
|
if argv[-1].endswith('seasonedFolders.py'):
|
||||||
|
findStray()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
elif not argv[-1].isdigit() or not argv[-2].isdigit():
|
||||||
|
print(" Missing sesason- or episode number.\nRequired input: [show name] [season nr] [episode nr]")
|
||||||
|
exit(0)
|
||||||
|
show = ' '.join(argv[1:-2])
|
||||||
|
season = '{:02}'.format(int(argv[-2]))
|
||||||
|
episode = '{:02}'.format(int(argv[-1]))
|
||||||
|
|
||||||
|
parse(show, season, episode)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
5180
subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv].srt
Executable file
5180
subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv].srt
Executable file
File diff suppressed because it is too large
Load Diff
4815
subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv]ENGLUISH.srt
Executable file
4815
subs/The.Man.from.U.N.C.L.E.2015.1080p-[eztv]ENGLUISH.srt
Executable file
File diff suppressed because it is too large
Load Diff
59
twitterConversation.py
Executable file
59
twitterConversation.py
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Author: KevinMidboe
|
||||||
|
# @Date: 2017-03-04 14:06:53
|
||||||
|
# @Last Modified by: KevinMidboe
|
||||||
|
# @Last Modified time: 2017-03-04 22:16:45
|
||||||
|
|
||||||
|
import tweepy
|
||||||
|
from pasteee import Paste
|
||||||
|
|
||||||
|
consumer_key, consumer_secret = 'yvVTrxNtVsLkoHxKWxh4xvgjg', '39OW6Q8fIKDXvTPPCaEJDULcYaHC5XZ3fe7HHCGtdepBKui2jK'
|
||||||
|
access_token, access_token_secret = '3214835117-OXVVLYeqUScRAPMqfVw5hS8NI63zPnWOVK63C5I', 'ClcGnF8vW6DbvgRgjwU6YjDc9f2oxMzOvUAN8kzpsmbcL'
|
||||||
|
|
||||||
|
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
|
||||||
|
auth.set_access_token(access_token, access_token_secret)
|
||||||
|
api = tweepy.API(auth)
|
||||||
|
apiUser = api.me()
|
||||||
|
apiUsername, apiUserID = apiUser.screen_name, apiUser.id_str
|
||||||
|
|
||||||
|
pasteText = '''episode': '18',
|
||||||
|
'full_path': '/Volumes/media/tv/New.Girl.S06E18.720p.HDTV.x264-FLEET',
|
||||||
|
'media_items': [['New.Girl.S06E18.720p.HDTV.x264-FLEET.mkv', '-FLEET']],
|
||||||
|
'name': 'New Girl',
|
||||||
|
'original': 'New.Girl.S06E18.720p.HDTV.x264-FLEET',
|
||||||
|
'season': '06',
|
||||||
|
'subtitles': [['New.Girl.S06E18.720p.HDTV.x264-EZTV.srt', '-EZTV', 'nl'],
|
||||||
|
['New.Girl.S06E18.720p.HDTV.x264-FLEET.srt', '-FLEET', 'en']],
|
||||||
|
'trash': ['Screens',
|
||||||
|
'new.girl.s06e18.720p.hdtv.x264-fleet.nfo',
|
||||||
|
'Torrent Downloaded From www.torrenting.me.txt']'''
|
||||||
|
|
||||||
|
def lastTweet(user, count=1):
|
||||||
|
return api.user_timeline(screen_name=user,count=count)
|
||||||
|
|
||||||
|
def checkReply():
|
||||||
|
originalTweet = lastTweet('pi_midboe')[0]
|
||||||
|
originalID, lastText = originalTweet.id_str, originalTweet.text
|
||||||
|
|
||||||
|
tweets = lastTweet('KevinMidboe', 40)
|
||||||
|
|
||||||
|
for tweet in tweets:
|
||||||
|
tweetID = tweet.in_reply_to_status_id_str
|
||||||
|
if tweetID == originalID:
|
||||||
|
print(tweet.text)
|
||||||
|
|
||||||
|
def tweet(tweetString):
|
||||||
|
if not lastTweet('pi_midboe')[0].text.startswith(tweetString):
|
||||||
|
paste = Paste(pasteText, private=False, desc="My first paste", views=2)
|
||||||
|
tweetString += paste['raw']
|
||||||
|
response = api.update_status(status=tweetString)
|
||||||
|
print('\n', response.text)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
tweet('@KevinMidboe\nAdded episode: \nNew Girl S06E16\n\nDetails: ')
|
||||||
|
checkReply()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user