Compare commits
8 Commits
15885c5676
...
master
Author | SHA1 | Date | |
---|---|---|---|
27490823d6 | |||
88c62f3b97 | |||
8ff9869399 | |||
b25c43458a | |||
4d00138b32 | |||
52b2e0e56b | |||
164d120220 | |||
67c4bfb9ac |
11
.drone.yml
11
.drone.yml
@ -22,8 +22,9 @@ steps: # 定义管道的执行步骤
|
||||
password:
|
||||
from_secret: docker_passwd
|
||||
dockerfile: Dockerfile
|
||||
registry: https://git.hiiragi.club:8081
|
||||
repo: git.hiiragi.club:8081/mol/middle-server
|
||||
mirror: https://fpswa5tm.mirror.aliyuncs.com
|
||||
registry: https://git.liliyamol.cn
|
||||
repo: git.liliyamol.cn/mol/middle-server
|
||||
auto_tag: true
|
||||
|
||||
---
|
||||
@ -52,11 +53,11 @@ steps:
|
||||
secrets: [docker_username, docker_passwd]
|
||||
script:
|
||||
- echo ==-----==开始部署==-----==
|
||||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWD git.hiiragi.club:8081
|
||||
- docker pull git.hiiragi.club:8081/mol/middle-server:latest
|
||||
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWD git.liliyamol.cn
|
||||
- docker pull git.liliyamol.cn/mol/middle-server:latest
|
||||
- list=$(docker ps -a | grep middle_server* | awk '{print $1}')
|
||||
- test "$list" = "" && echo "none middle_server containers running" || docker stop $list && docker container rm $list
|
||||
# 过滤出dockerImages的id, 删除none镜像
|
||||
- docker run -d -p 15000:80 --name=middle_server_${DRONE_TAG} git.hiiragi.club:8081/mol/middle-server:latest
|
||||
- docker run -d -p 15000:80 --restart=always --name=middle_server git.liliyamol.cn/mol/middle-server:latest
|
||||
- docker rmi $(docker images | grep "none" | awk '{print $3}')
|
||||
- echo ==-----==部署成功==-----==
|
||||
|
@ -1,7 +1,7 @@
|
||||
import requests
|
||||
|
||||
def getToken():
|
||||
body = { 'username': 'mol', 'password': 'c!UxnePTkwBMb7' }
|
||||
body = { 'username': 'fan@yunying.com', 'password': 'm%Bn$w5jgiNsNC' }
|
||||
res = requests.post('http://192.168.124.12:4533/music/auth/login', json = body)
|
||||
resJson = res.json()
|
||||
return resJson.get('token')
|
@ -1,28 +1,30 @@
|
||||
import os
|
||||
from webdav3.client import Client
|
||||
from webdav3.exceptions import LocalResourceNotFound, RemoteResourceNotFound
|
||||
|
||||
def sync():
|
||||
options = {
|
||||
'webdav_hostname': 'https://pan.hiiragi.club:8081/dav',
|
||||
'webdav_login': 'mol',
|
||||
'webdav_password': 'YvG4SkF82qd7ks',
|
||||
'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!')
|
||||
|
||||
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!!')
|
Reference in New Issue
Block a user