diff options
author | Carlos Guzman <carlosguzmang@hotmail.com> | 2017-11-28 10:46:11 -0500 |
---|---|---|
committer | enen92 <enen92@users.noreply.github.com> | 2017-11-28 15:46:11 +0000 |
commit | 6b5ac83bd0578b65be1758393094176e55fb449a (patch) | |
tree | 12d4ddf9569568433aa8512ce42384cbeec6ea71 /plugin.onedrive/resources | |
parent | 09c8dddc12a7dfe51294e1ab3f813d85359e064b (diff) |
[plugin.onedrive] 2.0.0 (#1493)
Diffstat (limited to 'plugin.onedrive/resources')
-rw-r--r-- | plugin.onedrive/resources/__init__.py | 0 | ||||
-rw-r--r-- | plugin.onedrive/resources/language/resource.language.en_gb/strings.po | 70 | ||||
-rw-r--r-- | plugin.onedrive/resources/language/resource.language.he_il/strings.po | 70 | ||||
-rw-r--r-- | plugin.onedrive/resources/lib/__init__.py | 0 | ||||
-rw-r--r-- | plugin.onedrive/resources/lib/migration.py | 57 | ||||
-rw-r--r-- | plugin.onedrive/resources/lib/provider/__init__.py | 0 | ||||
-rw-r--r-- | plugin.onedrive/resources/lib/provider/onedrive.py | 74 | ||||
-rw-r--r-- | plugin.onedrive/resources/settings.xml | 16 |
8 files changed, 287 insertions, 0 deletions
diff --git a/plugin.onedrive/resources/__init__.py b/plugin.onedrive/resources/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugin.onedrive/resources/__init__.py diff --git a/plugin.onedrive/resources/language/resource.language.en_gb/strings.po b/plugin.onedrive/resources/language/resource.language.en_gb/strings.po new file mode 100644 index 0000000..bd17338 --- /dev/null +++ b/plugin.onedrive/resources/language/resource.language.en_gb/strings.po @@ -0,0 +1,70 @@ +# Kodi Media Center language file +# Addon Name: OneDrive +# Addon id: plugin.onedrive +# Addon Provider: Carlos Guzman (cguZZman) +msgid "" +msgstr "" +"Project-Id-Version: Kodi Addons\n" +"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kodi Translation Team\n" +"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#32000" +msgid "Account" +msgstr "" + +msgctxt "#32001" +msgid "Video Library Export Folder" +msgstr "" + +msgctxt "#32002" +msgid "Music Library Export Folder" +msgstr "" + +msgctxt "#32003" +msgid "Before export to library, remove previous files and folders" +msgstr "" + +msgctxt "#32004" +msgid "When playing videos, set the subtitle file located next to the video (.srt)" +msgstr "" + +msgctxt "#32005" +msgid "Auto-Refreshed slideshow" +msgstr "" + +msgctxt "#32006" +msgid "Refresh interval in minutes" +msgstr "" + +msgctxt "#32007" +msgid "Special: Photos" +msgstr "" + +msgctxt "#32008" +msgid "Special: Camera Roll" +msgstr "" + +msgctxt "#32009" +msgid "Special: Music" +msgstr "" + +msgctxt "#32010" +msgid "Recursive auto-refreshed slideshow" +msgstr "" + +msgctxt "#32011" +msgid "Common Settings" +msgstr "" + +msgctxt "#32012" +msgid "Open Cloud Drive Common Settings..." +msgstr "" + diff --git a/plugin.onedrive/resources/language/resource.language.he_il/strings.po b/plugin.onedrive/resources/language/resource.language.he_il/strings.po new file mode 100644 index 0000000..dbe8f80 --- /dev/null +++ b/plugin.onedrive/resources/language/resource.language.he_il/strings.po @@ -0,0 +1,70 @@ +# Kodi Media Center language file +# Addon Name: OneDrive +# Addon id: plugin.onedrive +# Addon Provider: Carlos Guzman (cguZZman) +msgid "" +msgstr "" +"Project-Id-Version: Kodi Addons\n" +"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2017-10-19 11:41+0300\n" +"Last-Translator: A. Dambledore\n" +"Language-Team: Eng2Heb\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: he_IL\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#32000" +msgid "Account" +msgstr "חשבון" + +msgctxt "#32001" +msgid "Video Library Export Folder" +msgstr "תיקיית ייצוא ספריית וידאו" + +msgctxt "#32002" +msgid "Music Library Export Folder" +msgstr "תיקיית ייצוא ספריית מוזיקה" + +msgctxt "#32003" +msgid "Before export to library, remove previous files and folders" +msgstr "לפני ייצוא לספריה, הסר את הקבצים והתיקיות הקודמים" + +msgctxt "#32004" +msgid "When playing videos, set the subtitle file located next to the video (.srt)" +msgstr "בעת ניגון וידאו, הגדר את קובץ הכתוביות הממוקם ליד הווידאו (.srt)" + +msgctxt "#32005" +msgid "Auto-Refreshed slideshow" +msgstr "מצגת עם רענון אוטומטי" + +msgctxt "#32006" +msgid "Refresh interval in minutes" +msgstr "מרווח זמן לרענון בדקות" + +msgctxt "#32007" +msgid "Special: Photos" +msgstr "מיוחד: תמונות" + +msgctxt "#32008" +msgid "Special: Camera Roll" +msgstr "מיוחד: סיבוב המצלמה" + +msgctxt "#32009" +msgid "Special: Music" +msgstr "מיוחד: מוסיקה" + +msgctxt "#32010" +msgid "Recursive auto-refreshed slideshow" +msgstr "רענן מצגת באופן רקורסיבי ואוטומטי" + +msgctxt "#32011" +msgid "Common Settings" +msgstr "הגדרות נפוצות" + +msgctxt "#32012" +msgid "Open Cloud Drive Common Settings..." +msgstr "פתח הגדרות נפוצות של כונן ענן ..." + diff --git a/plugin.onedrive/resources/lib/__init__.py b/plugin.onedrive/resources/lib/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugin.onedrive/resources/lib/__init__.py diff --git a/plugin.onedrive/resources/lib/migration.py b/plugin.onedrive/resources/lib/migration.py new file mode 100644 index 0000000..2614edc --- /dev/null +++ b/plugin.onedrive/resources/lib/migration.py @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------- +# Copyright (C) 2017 Carlos Guzman (cguZZman) carlosguzmang@protonmail.com +# +# This file is part of OneDrive for Kodi +# +# OneDrive for Kodi 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 3 of the License, or +# (at your option) any later version. +# +# Cloud Drive Common Module for Kodi 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 this program. If not, see <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------------------- + +import os +from clouddrive.common.utils import Utils +from clouddrive.common.ui.utils import KodiUtils +from ConfigParser import ConfigParser +from clouddrive.common.account import AccountManager +from clouddrive.common.ui.logger import Logger +from clouddrive.common.exception import UIException + + +class MigrateAccounts(object): + def __init__(self): + profile_path = Utils.unicode(KodiUtils.translate_path(KodiUtils.get_addon_info('profile'))) + ini_path = os.path.join(profile_path, 'onedrive.ini') + if os.path.exists(ini_path): + config = ConfigParser() + account_manager = AccountManager(profile_path) + config.read(ini_path) + for driveid in config.sections(): + Logger.notice('Migrating drive %s...' % driveid) + account = { 'id' : driveid, 'name' : config.get(driveid, 'name')} + account['drives'] = [{ + 'id' : driveid, + 'name' : '', + 'type' : 'migrated' + }] + account['access_tokens'] = { + 'access_token': config.get(driveid, 'access_token'), + 'refresh_token': config.get(driveid, 'refresh_token'), + 'expires_in': 0, + 'date': 0 + } + try: + account_manager.add_account(account) + except Exception as e: + raise UIException(32021, e) + os.remove(ini_path) + KodiUtils.set_addon_setting('migrated', 'true') +
\ No newline at end of file diff --git a/plugin.onedrive/resources/lib/provider/__init__.py b/plugin.onedrive/resources/lib/provider/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugin.onedrive/resources/lib/provider/__init__.py diff --git a/plugin.onedrive/resources/lib/provider/onedrive.py b/plugin.onedrive/resources/lib/provider/onedrive.py new file mode 100644 index 0000000..f146a6a --- /dev/null +++ b/plugin.onedrive/resources/lib/provider/onedrive.py @@ -0,0 +1,74 @@ +#------------------------------------------------------------------------------- +# Copyright (C) 2017 Carlos Guzman (cguZZman) carlosguzmang@protonmail.com +# +# This file is part of OneDrive for Kodi +# +# OneDrive for Kodi 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 3 of the License, or +# (at your option) any later version. +# +# Cloud Drive Common Module for Kodi 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 this program. If not, see <http://www.gnu.org/licenses/>. +#------------------------------------------------------------------------------- + +from clouddrive.common.remote.provider import Provider +from clouddrive.common.utils import Utils + + +class OneDrive(Provider): + __api_url = 'https://graph.microsoft.com/v1.0' + + def __init__(self): + super(OneDrive, self).__init__('onedrive') + + def _get_api_url(self): + return self.__api_url + + def _get_request_headers(self): + return None + + def get_account(self, request_params={}, access_tokens={}): + me = self.get('/me', request_params=request_params, access_tokens=access_tokens) + if not me: + raise Exception('NoAccountInfo') + return { 'id' : me['id'], 'name' : me['displayName']} + + def get_drives(self, request_params={}, access_tokens={}): + response = self.get('/drives', request_params=request_params, access_tokens=access_tokens) + drives = [] + drives_id_list =[] + for drive in response['value']: + drives_id_list.append(drive['id']) + drives.append({ + 'id' : drive['id'], + 'name' : Utils.get_safe_value(drive, 'name', ''), + 'type' : drive['driveType'] + }) + + response = self.get('/me/drives', request_params=request_params, access_tokens=access_tokens) + for drive in response['value']: + if not drive['id'] in drives_id_list: + drives_id_list.append(drive['id']) + drives.append({ + 'id' : drive['id'], + 'name' : Utils.get_safe_value(drive, 'name', ''), + 'type' : drive['driveType'] + }) + return drives + + def get_drive_type_name(self, drive_type): + if drive_type == 'personal': + return 'OneDrive Personal' + elif drive_type == 'business': + return 'OneDrive for Business' + elif drive_type == 'documentLibrary': + return ' SharePoint Document Library' + return drive_type + +
\ No newline at end of file diff --git a/plugin.onedrive/resources/settings.xml b/plugin.onedrive/resources/settings.xml new file mode 100644 index 0000000..d4ee6f7 --- /dev/null +++ b/plugin.onedrive/resources/settings.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<settings > + <category label="32000"> + <setting label="32001" type="folder" id="video_library_folder" option="writeable"/> + <setting label="32002" type="folder" id="music_library_folder" option="writeable"/> + <setting label="32003" type="bool" id="clean_folder" default="true" value="true"/> + <setting label="32004" type="bool" id="set_subtitle" default="true" value="true"/> + </category> + <category label="32005"> + <setting label="32006" type="number" id="slideshow_refresh_interval" default="5" value="5"/> + <setting label="32010" type="bool" id="slideshow_recursive" default="false" value="false"/> + </category> + <category label="32011"> + <setting label="32012" type="action" option="close" action="RunPlugin(plugin://plugin.onedrive/?action=_open_common_settings)"/> + </category> +</settings> |