-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
moedje
committed
May 17, 2017
0 parents
commit 21cd884
Showing
41 changed files
with
3,819 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## plugin.video.tumblrV | ||
### Kodi/XBMC Addon for Video's on Tumblr | ||
This is an in development addon to watch and download video's from tumblr blogs. | ||
|
||
GayMods RepoKodi Repo for Gay Addons (https://github.com/moedje/kodi-repo-gaymods) | ||
### REQUIRED TO WORK: OAuth from Tumblr | ||
You need to authorize the app with Tumblr to your account so we can retrieve your following, liked, dashboard, etc. I do not have an easy way to do this in Kodi yet and I am working on this. For now you have to do this with a browser that you are logged into tumblr simply visit: | ||
####https://api.tumblr.com/console/calls/user/info | ||
Consumer Key: **5wEwFCF0rbiHXYZQQeQnNetuwZMmIyrUxIePLqUMcZlheVXwc4** | ||
|
||
Consumer Secret: **GCLMI2LnMZqO2b5QheRvUSYY51Ujk7nWG2sYroqozW06x4hWch** | ||
|
||
Tumblr will give you back an **OAUTH_TOKEN and OAUTH_SECRET** you need to put this into the addon's settings and then it will work. If anyone knows how to make this work easier from within Kodi that would be most helpful!! | ||
### Features | ||
The planned functions for this addon are listed below including the status of whether they are completed or not. | ||
|
||
*updated 7 May 2017* | ||
|
||
-[x] OAuth2 login to Tumblr: Give URL to enter displayed CONSUMER KEY and SECRET to generate OAUTH Token and Secret | ||
-[ ] OAuth2 Can we make this easier to get OAUTH Token and Secret? Within Kodi and not browser? | ||
-[x] Dashboard Video's | ||
-[x] List of Following Blogs | ||
-[x] List of Video's from a blog | ||
-[x] List More/Older Video's from a blog | ||
-[x] Collect TAGS from any video's as you use addon | ||
-[x] List all collected tags and display video's with this tag | ||
-[x] Display Liked Videos | ||
-[ ] Ability to Like/save a video | ||
-[ ] Download A Video | ||
-[ ] Download All Liked/Dash/Category Videos | ||
-[ ] Download based on dates | ||
-[ ] Search Tumblr / Search a Blog / Other types of searches? | ||
-[ ] Handle Picture Posts? | ||
|
||
|
||
## ABOUT ME | ||
- Author: Jeremy [email protected] | ||
- http://www.2my.cc/ | ||
- Founder: [CryptoCoins.Com] Physical CryptoCurrency Worth Holding Onto | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<addons> | ||
<addon id="plugin.video.tumblrv" name="TumblrV" version="0.9.3" provider-name="moedje"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.25.0" /> | ||
<import addon="script.module.kodiswift" version="0.0.8" /> | ||
<import addon="script.module.requests" version="2.9.1" /> | ||
<import addon="script.module.oauth2" /> | ||
<import addon="script.module.xbmcutil" /> | ||
<import addon="script.module.urlresolver" /> | ||
<import addon="script.module.youtube.dl" /> | ||
</requires> | ||
<extension point="xbmc.python.pluginsource" library="addon.py"> | ||
<provides>video</provides> | ||
</extension> | ||
<extension point="xbmc.addon.metadata"> | ||
<platform>all</platform> | ||
<language>en</language> | ||
<summary lang="en">plugin.video.tumblrV Kodi/XBMC Addon for watching Videos from Tumblr</summary> | ||
<description lang="en">V0.9.3: First public preview most features working. http://github.com/moedje/ Read the instructions about how to get your OAUTH_TOKEN and OAUTH_SECRET from Tumblr. It is required to login to Tumblr from an external App like this one. [COLOR red]YOU must put your OAUTH Token and Secret in settings[/COLOR] This will not work if you do not visit below Tumblr URL and put this App's Consumer Key and Secret in to generate an OAUTH token! | ||
[COLOR red]https://api.tumblr.com/console/calls/user/info REQUIRED TO GET OAUTH TOKEN TO PUT IN SETTINGS[/COLOR] | ||
Consumer Key: [B]5wEwFCF0rbiHXYZQQeQnNetuwZMmIyrUxIePLqUMcZlheVXwc4[/B] | ||
Consumer Secret: [B]GCLMI2LnMZqO2b5QheRvUSYY51Ujk7nWG2sYroqozW06x4hWch[/B] | ||
</description> | ||
<disclaimer lang="en">May contain adult content so you must be of legal age in your jurisdiction to use tumblrV to view adult content.</disclaimer> | ||
</extension> | ||
</addon> | ||
</addons> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6e050e1ab77bf68e74618f0cc716c5ea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
#!/usr/bin/python | ||
# * | ||
# * Copyright (C) 2012-2013 Garrett Brown | ||
# * Copyright (C) 2010 j48antialias | ||
# * | ||
# * This Program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 2, or (at your option) | ||
# * any later version. | ||
# * | ||
# * This Program is distributed in the hope that it will be useful, | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# * GNU General Public License for more details. | ||
# * | ||
# * You should have received a copy of the GNU General Public License | ||
# * along with XBMC; see the file COPYING. If not, write to | ||
# * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
# * http://www.gnu.org/copyleft/gpl.html | ||
# * | ||
# * Based on code by j48antialias: | ||
# * https://anarchintosh-projects.googlecode.com/files/addons_xml_generator.py | ||
|
||
""" addons.xml generator """ | ||
|
||
import os | ||
import sys | ||
import time | ||
import re | ||
import xml.etree.ElementTree as ET | ||
try: | ||
import shutil, zipfile | ||
except Exception as e: | ||
print('An error occurred importing module!\n%s\n' % e) | ||
|
||
# Compatibility with 3.0, 3.1 and 3.2 not supporting u"" literals | ||
print(sys.version) | ||
if sys.version < '3': | ||
import codecs | ||
def u(x): | ||
return codecs.unicode_escape_decode(x)[0] | ||
else: | ||
def u(x): | ||
return x | ||
|
||
class Generator: | ||
""" | ||
Generates a new addons.xml file from each addons addon.xml file | ||
and a new addons.xml.md5 hash file. Must be run from the root of | ||
the checked-out repo. Only handles single depth folder structure. | ||
""" | ||
def __init__(self): | ||
# generate files | ||
self._generate_addons_file() | ||
self._generate_md5_file() | ||
# notify user | ||
print("Finished updating addons xml and md5 files\n") | ||
|
||
def _generate_addons_file(self): | ||
# addon list | ||
addons = os.listdir(".") | ||
# final addons text | ||
addons_xml = u("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<addons>\n") | ||
# loop thru and add each addons addon.xml file | ||
for addon in addons: | ||
try: | ||
# skip any file or .svn folder or .git folder | ||
if (not os.path.isdir(addon) or addon == ".svn" or addon == ".git" or addon == "zips"): continue | ||
# create path | ||
_path = os.path.join(addon, "addon.xml") | ||
# split lines for stripping | ||
xml_lines = open(_path, "r").read().splitlines() | ||
# new addon | ||
addon_xml = "" | ||
# loop thru cleaning each line | ||
for line in xml_lines: | ||
# skip encoding format line | ||
if (line.find("<?xml") >= 0): continue | ||
# add line | ||
if sys.version < '3': | ||
addon_xml += unicode(line.rstrip() + "\n", "UTF-8") | ||
else: | ||
addon_xml += line.rstrip() + "\n" | ||
# we succeeded so add to our final addons.xml text | ||
addons_xml += addon_xml.rstrip() + "\n\n" | ||
except Exception as e: | ||
# missing or poorly formatted addon.xml | ||
print("Excluding %s for %s" % (_path, e)) | ||
# clean and add closing tag | ||
addons_xml = addons_xml.strip() + u("\n</addons>\n") | ||
# save file | ||
self._save_file(addons_xml.encode("UTF-8"), file="addons.xml") | ||
|
||
def _generate_md5_file(self): | ||
# create a new md5 hash | ||
try: | ||
import md5 | ||
m = md5.new(open("addons.xml", "r").read()).hexdigest() | ||
except ImportError: | ||
import hashlib | ||
m = hashlib.md5(open("addons.xml", "r", encoding="UTF-8").read().encode("UTF-8")).hexdigest() | ||
|
||
# save file | ||
try: | ||
self._save_file(m.encode("UTF-8"), file="addons.xml.md5") | ||
except Exception as e: | ||
# oops | ||
print("An error occurred creating addons.xml.md5 file!\n%s" % e) | ||
|
||
def _save_file(self, data, file): | ||
try: | ||
# write data to the file (use b for Python 3) | ||
open(file, "wb").write(data) | ||
except Exception as e: | ||
# oops | ||
print("An error occurred saving %s file!\n%s" % (file, e)) | ||
|
||
|
||
def zipfolder(foldername, target_dir, zips_dir, addon_dir): | ||
zipobj = zipfile.ZipFile(zips_dir + foldername, 'w', zipfile.ZIP_DEFLATED) | ||
rootlen = len(target_dir) + 1 | ||
for base, dirs, files in os.walk(target_dir): | ||
for f in files: | ||
fn = os.path.join(base, f) | ||
zipobj.write(fn, os.path.join(addon_dir, fn[rootlen:])) | ||
zipobj.close() | ||
|
||
|
||
|
||
if (__name__ == "__main__"): | ||
# start | ||
Generator() | ||
|
||
# rezip files and move | ||
try: | ||
print('Starting zip file creation...') | ||
rootdir = sys.path[0] | ||
zipsdir = rootdir + os.sep + 'zips' | ||
filesinrootdir = os.listdir(rootdir) | ||
|
||
for x in filesinrootdir: | ||
if re.search("^(context|plugin|script|service|skin|repository)" , x) and not re.search('.zip', x): | ||
zipfilename = x + '.zip' | ||
zipfilenamefirstpart = zipfilename[:-4] | ||
zipfilenamelastpart = zipfilename[len(zipfilename) - 4:] | ||
zipsfolder = os.path.normpath(os.path.join('zips', x)) + os.sep | ||
foldertozip = rootdir + os.sep + x | ||
filesinfoldertozip = os.listdir(foldertozip) | ||
# #check if zips folder exists | ||
if not os.path.exists(zipsfolder): | ||
os.makedirs(zipsfolder) | ||
print('Directory doesn\'t exist, creating: ' + zipsfolder) | ||
# #get addon version number | ||
if "addon.xml" in filesinfoldertozip: | ||
tree = ET.parse(os.path.join(rootdir, x, "addon.xml")) | ||
root = tree.getroot() | ||
for elem in root.iter('addon'): | ||
print('%s %s version: %s' % (x, elem.tag, elem.attrib['version'])) | ||
version = '-' + elem.attrib['version'] | ||
# #check if and move addon, changelog, fanart and icon to zipdir | ||
for y in filesinfoldertozip: | ||
# print('processing file: ' + os.path.join(rootdir,x,y)) | ||
if re.search("addon|changelog|icon|fanart", y): | ||
shutil.copyfile(os.path.join(rootdir, x, y), os.path.join(zipsfolder, y)) | ||
print('Copying %s to %s' % (y, zipsfolder)) | ||
# #check for and zip the folders | ||
print('Zipping %s and moving to %s\n' % (x, zipsfolder)) | ||
zfilename = zipfilenamefirstpart + version + zipfilenamelastpart | ||
try: | ||
zipfolder(zfilename, foldertozip, zipsfolder, x) | ||
print('zipped with zipfolder\n') | ||
except: | ||
if os.path.exists(zipsfolder + x + version + '.zip'): | ||
os.remove(zipsfolder + x + version + '.zip') | ||
print('trying shutil') | ||
try: | ||
shutil.move(shutil.make_archive(foldertozip + version, 'zip', rootdir, x), zipsfolder) | ||
print('zipped with shutil\n') | ||
except Exception as e: | ||
print('Cannot create zip file\nshutil %s\n' % e) | ||
fpath = os.path.join(rootdir, zipsfolder, zfilename) | ||
shutil.copyfile(fpath, fpath.replace("zips/","")) | ||
fpath = fpath.replace(rootdir, "") | ||
print('Copying .{0} to .{1}'.format(fpath, fpath.replace("zips/",""))) | ||
except Exception as e: | ||
print('Cannot create or move the needed files\n%s' % e) | ||
print('Done') |
Binary file not shown.
Oops, something went wrong.