Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove setup.py #879

Merged
merged 9 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ cython_debug/
# vscode
.vscode/

setup.cfg
nemcache.sqlite

#Jetbrains
Expand Down
36 changes: 35 additions & 1 deletion ChangeLog.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
## 更新日志
# 更新日志

2018-05-21 版本 0.2.4.3 更新依赖,错误修复

2017-11-28 版本 0.2.4.2 更新获取歌曲列表的api

2017-06-03 版本 0.2.4.1 修正mpg123状态异常导致的cpu占用,增加歌词双行显示功能

2017-03-17 版本 0.2.4.0 修复通知可能造成的崩溃

2017-03-03 版本 0.2.3.9 邮箱用户登录修复

2017-03-02 版本 0.2.3.8 登录接口修复

2016-11-24 版本 0.2.3.7 新增背景色设置

2016-11-07 版本 0.2.3.6 已知错误修复

2016-10-16 版本 0.2.3.5 新增进入歌曲专辑功能

2016-10-13 版本 0.2.3.4 新增查看歌曲评论

2016-09-26 版本 0.2.3.3 keybinder 错误修复

2016-09-15 版本 0.2.3.2 已知错误修复

2016-09-12 版本 0.2.3.1 已知错误修复

2016-09-11 版本 0.2.3.0 Python 2 和 3 支持

2016-05-09 版本 0.2.2.10 修复最后一行歌名过长的问题

2016-05-08 版本 0.2.2.9 缓存问题修复

2016-05-07 版本 0.2.2.8 解决通知在Gnome桌面持续驻留(#303)的问题

2016-05-07 版本 0.2.2.6 已知错误修复

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 omi <[email protected]>
Copyright (c) 2020 omi <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

37 changes: 28 additions & 9 deletions NEMbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
from .const import Constant
from .utils import create_dir
from .utils import create_file

create_dir(Constant.conf_dir)
create_dir(Constant.download_dir)
create_file(Constant.storage_path)
create_file(Constant.log_path, default="")
create_file(Constant.cookie_path, default="#LWP-Cookies-2.0\n")
r"""
__ ___________________________________________
| \ ||______ | |______|_____||______|______
| \_||______ | |______| |______||______

________ __________________________ _____ _ _
| | || ||______ | | |_____]| | \___/
| | ||_____|______|__|__|_____ |_____]|_____|_/ \_


+ ------------------------------------------ +
| NetEase-MusicBox 320kbps |
+ ------------------------------------------ +
| |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| |
| A sexy cli musicbox based on Python |
| Music resource from music.163.com |
| |
| Built with love to music by omi |
| |
+ ------------------------------------------ +

"""
53 changes: 24 additions & 29 deletions NEMbox/__main__.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__ ___________________________________________
| \ ||______ | |______|_____||______|______
| \_||______ | |______| |______||______

________ __________________________ _____ _ _
| | || ||______ | | |_____]| | \___/
| | ||_____|______|__|__|_____ |_____]|_____|_/ \_


+ ------------------------------------------ +
| NetEase-MusicBox 320kbps |
+ ------------------------------------------ +
| |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| ++++++++++++++++++++++++++++++++++++++ |
| |
| A sexy cli musicbox based on Python |
| Music resource from music.163.com |
| |
| Built with love to music by omi |
| |
+ ------------------------------------------ +

"""
import argparse
import curses
import sys
import traceback
from pathlib import Path

import toml

from .__version__ import __version__ as version
from .const import Constant
from .menu import Menu
from .utils import create_dir
from .utils import create_file


def create_config():
create_dir(Constant.conf_dir)
create_dir(Constant.download_dir)
create_file(Constant.storage_path)
create_file(Constant.log_path, default="")
create_file(Constant.cookie_path, default="#LWP-Cookies-2.0\n")


def get_current_version():
path = Path(".").parent.parent / "pyproject.toml"
with path.open() as f:
config = toml.load(f)
return config["tool"]["poetry"]["version"]


def start():
create_config()
version = get_current_version()

parser = argparse.ArgumentParser()
parser.add_argument(
"-v", "--version", help="show this version and exit", action="store_true"
Expand Down
17 changes: 0 additions & 17 deletions NEMbox/__version__.py

This file was deleted.

6 changes: 4 additions & 2 deletions NEMbox/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def __init__(self):

@property
def toplists(self):
return [l[0] for l in TOP_LIST_ALL.values()]
return [item[0] for item in TOP_LIST_ALL.values()]

def logout(self):
self.session.cookies.clear()
Expand All @@ -314,6 +314,7 @@ def logout(self):
self.storage.save()

def _raw_request(self, method, endpoint, data=None):
resp = None
if method == "GET":
resp = self.session.get(
endpoint, params=data, headers=self.header, timeout=DEFAULT_TIMEOUT
Expand Down Expand Up @@ -360,12 +361,13 @@ def request(self, method, path, params={}, default={"code": -1}, custom_cookies=
self.session.cookies.set_cookie(cookie)

params = encrypted_request(params)
resp = None
try:
resp = self._raw_request(method, endpoint, params)
data = resp.json()
except requests.exceptions.RequestException as e:
log.error(e)
except ValueError as e:
except ValueError:
log.error("Path: {}, response: {}".format(path, resp.text[:200]))
finally:
return data
Expand Down
9 changes: 4 additions & 5 deletions NEMbox/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def check_version(self):

data = self.api.get_version()
return data["info"]["version"]
except KeyError as e:
except KeyError:
return 0

def start_fork(self, version):
Expand Down Expand Up @@ -423,7 +423,7 @@ def enter_page_event(self):
self.menu_starts = time.time()
self.ui.build_loading()
self.dispatch_enter(idx)
if self.enter_flag == True:
if self.enter_flag:
self.index = 0
self.offset = 0

Expand Down Expand Up @@ -706,7 +706,7 @@ def start(self):

# 模糊搜索
elif C.keyname(key).decode("utf-8") == keyMap["search"]:
if self.at_search_result == True:
if self.at_search_result:
self.back_page_event()
self.stack.append(
[self.datatype, self.title, self.datalist, self.offset, self.index]
Expand Down Expand Up @@ -1050,7 +1050,6 @@ def dispatch_enter(self, idx):
# 子类别
data = self.datalist[idx]
self.datatype = "top_playlists"
log.error(data)
self.datalist = netease.dig_info(netease.top_playlists(data), self.datatype)
self.title += " > " + data

Expand Down Expand Up @@ -1127,7 +1126,7 @@ def show_playing_song(self):
)
self.at_playing_list = True

if self.at_search_result == True:
if self.at_search_result:
self.back_page_event()

self.datatype = self.player.info["player_list_type"]
Expand Down
111 changes: 0 additions & 111 deletions NEMbox/terminalsize.py

This file was deleted.

4 changes: 1 addition & 3 deletions NEMbox/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import hashlib
import os
import re
from curses import textpad
from shutil import get_terminal_size

from . import logger
Expand Down Expand Up @@ -117,8 +116,7 @@ def addstr(self, *args):
try:
self.screen.addstr(args[0], args[1], args[2].encode("utf-8"), *args[3:])
except Exception as e:
# log.error(e, args)
pass
log.error(e)

def update_margin(self):
# Left margin
Expand Down
Loading