From 27490823d649fa37e2fda630a9bb933577f971c4 Mon Sep 17 00:00:00 2001 From: mol Date: Wed, 6 Nov 2024 14:52:13 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20plugin/NavidromePlaylistSy?= =?UTF-8?q?nc/sync.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/NavidromePlaylistSync/sync.py | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/plugin/NavidromePlaylistSync/sync.py b/plugin/NavidromePlaylistSync/sync.py index d97877a..3d2bf3e 100644 --- a/plugin/NavidromePlaylistSync/sync.py +++ b/plugin/NavidromePlaylistSync/sync.py @@ -1,30 +1,30 @@ -import os -from webdav3.client import Client -from webdav3.exceptions import LocalResourceNotFound, RemoteResourceNotFound, ResponseErrorCode - -def sync(): - options = { - 'webdav_hostname': 'https://pan.liliyamol.cn:8081/webdav/', - 'webdav_login': 'fan@yunying.com', - 'webdav_password': 'm%Bn$w5jgiNsNC', - 'disable_check': True, - } - - client = Client(options) - tempPath = os.path.join(os.path.dirname(__file__), 'temp') - playlists = os.listdir(tempPath) - - try: - client.clean('Music/#playlist') - except RemoteResourceNotFound as exception: - print('clean failed!') - except ResponseErrorCode as exception: - print('error') - - for fileName in playlists: - path = os.path.join(tempPath, fileName) - try: - client.upload('Music/#playlist/' + fileName, path) - print(fileName + ' upload success!!') - except LocalResourceNotFound as exception: +import os +from webdav3.client import Client +from webdav3.exceptions import LocalResourceNotFound, RemoteResourceNotFound, ResponseErrorCode + +def sync(): + options = { + 'webdav_hostname': 'https://pan.liliyamol.cn/webdav/', + 'webdav_login': 'fan@yunying.com', + 'webdav_password': 'm%Bn$w5jgiNsNC', + 'disable_check': True, + } + + client = Client(options) + tempPath = os.path.join(os.path.dirname(__file__), 'temp') + playlists = os.listdir(tempPath) + + try: + client.clean('Music/#playlist') + except RemoteResourceNotFound as exception: + print('clean failed!') + except ResponseErrorCode as exception: + print('error') + + for fileName in playlists: + path = os.path.join(tempPath, fileName) + try: + client.upload('Music/#playlist/' + fileName, path) + print(fileName + ' upload success!!') + except LocalResourceNotFound as exception: print(fileName + ' upload failed!!') \ No newline at end of file