Skip to content

Commit

Permalink
暂时移除所有对github的请求访问
Browse files Browse the repository at this point in the history
新增弹幕字体调整
更新vtbs
  • Loading branch information
zhimingshenjun committed Jan 26, 2021
1 parent 67e90fc commit 54ab63e
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 47 deletions.
14 changes: 11 additions & 3 deletions DD监控室.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def __init__(self, cacheFolder, progressBar, progressText):
if 'startWithDanmu' not in self.config:
self.config['startWithDanmu'] = True
logging.warn('启动时加载弹幕没有被设置,默认加载')
for danmuConfig in self.config['danmu']:
if len(danmuConfig) == 6:
danmuConfig.append(10)
else:
self.config = {
'roomid': {'21396545': False, '21402309': False, '22384516': False, '8792912': False,
Expand All @@ -172,7 +175,7 @@ def __init__(self, cacheFolder, progressBar, progressText):
'audioChannel': [0] * 9,
'muted': [1] * 9,
'volume': [50] * 9,
'danmu': [[True, 50, 1, 7, 0, '【 [ {']] * 9, # 显示弹幕, 透明度, 横向占比, 纵向占比, 显示同传, 同传过滤字符
'danmu': [[True, 50, 1, 7, 0, '【 [ {', 10]] * 9, # 显示,透明,横向,纵向,类型,同传字符,字体大小
'globalVolume': 30,
'control': True,
'hardwareDecode': True,
Expand All @@ -197,7 +200,9 @@ def __init__(self, cacheFolder, progressBar, progressText):
for i in range(9):
volume = self.config['volume'][i]
progressText.setText('设置第%s个主层播放器...' % str(i + 1))
self.videoWidgetList.append(VideoWidget(i, volume, cacheFolder, textSetting=self.config['danmu'][i], maxCacheSize = self.config['maxCacheSize'], startWithDanmu=self.config['startWithDanmu']))
self.videoWidgetList.append(VideoWidget(i, volume, cacheFolder, textSetting=self.config['danmu'][i],
maxCacheSize = self.config['maxCacheSize'],
startWithDanmu=self.config['startWithDanmu']))
vlcProgressCounter += 1
progressBar.setValue(vlcProgressCounter)
# self.videoWidgetList[i].mutedChanged.connect(self.mutedChanged) # 硬盘io过高 屏蔽掉 退出的时候统一保存
Expand All @@ -217,7 +222,9 @@ def __init__(self, cacheFolder, progressBar, progressText):
self.videoWidgetList[i].slider.setValue(self.config['volume'][i])
self.videoWidgetList[i].quality = self.config['quality'][i]
self.videoWidgetList[i].audioChannel = self.config['audioChannel'][i]
self.popVideoWidgetList.append(VideoWidget(i + 9, volume, cacheFolder, True, '悬浮窗', [1280, 720], maxCacheSize=self.config['maxCacheSize'], startWithDanmu=self.config['startWithDanmu']))
self.popVideoWidgetList.append(VideoWidget(i + 9, volume, cacheFolder, True, '悬浮窗', [1280, 720],
maxCacheSize=self.config['maxCacheSize'],
startWithDanmu=self.config['startWithDanmu']))
vlcProgressCounter += 1
progressBar.setValue(vlcProgressCounter)
progressText.setText('设置第%s个悬浮窗播放器...' % str(i + 1))
Expand Down Expand Up @@ -553,6 +560,7 @@ def openHotKey(self):
def openFeed(self):
self.pay.hide()
self.pay.show()
self.pay.thankToBoss.start()

def checkMousePos(self):
for videoWidget in self.videoWidgetList: # vlc的播放会直接音量最大化 实在没地方放了 写在这里实时强制修改它的音量
Expand Down
30 changes: 17 additions & 13 deletions LiverSelect.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,19 +419,23 @@ def __init__(self, parent=None):

def run(self):
try:
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'}
r = requests.get(r'https://github.com/zhimingshenjun/DD_Monitor/blob/master/utils/vtb.csv', headers=headers)
vtbList = []
html = r.text.split('\n')
for cnt, line in enumerate(html):
if 'blob-num js-line-number' in line:
vtbID = html[cnt + 1].split('>')[1].split('<')[0]
roomID = html[cnt + 2].split('>')[1].split('<')[0]
haco = html[cnt + 3].split('>')[1].split('<')[0]
vtbList.append('%s,%s,%s\n' % (vtbID, roomID, haco))
if vtbList:
self.vtbList.emit(vtbList)
# TODO 修改vtbs的请求方式
pass
# headers = {
# 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'}
# r = requests.get(r'https://ddmonitor-resource.oss-cn-beijing.aliyuncs.com/vtb.csv', headers=headers)
# r.encoding = 'gbk'
# vtbList = []
# html = r.text.split('\n')
# for cnt, line in enumerate(html):
# print(line)
# if 'blob-num js-line-number' in line:
# vtbID = html[cnt + 1].split('>')[1].split('<')[0]
# roomID = html[cnt + 2].split('>')[1].split('<')[0]
# haco = html[cnt + 3].split('>')[1].split('<')[0]
# vtbList.append('%s,%s,%s\n' % (vtbID, roomID, haco))
# if vtbList:
# self.vtbList.emit(vtbList)
except Exception as e:
logging.error(str(e))

Expand Down
49 changes: 30 additions & 19 deletions VideoWidget_vlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ class VideoWidget(QFrame):
fullScreenKey = pyqtSignal() # 全屏快捷键
muteExceptKey = pyqtSignal() # 除了这个播放器 其他全部静音快捷键

def __init__(self, id, volume, cacheFolder, top=False, title='', resize=[], textSetting=[True, 20, 2, 6, 0, '【 [ {'], maxCacheSize=2048000, startWithDanmu=True):
def __init__(self, id, volume, cacheFolder, top=False, title='', resize=[],
textSetting=[True, 20, 2, 6, 0, '【 [ {', 10], maxCacheSize=2048000, startWithDanmu=True):
super(VideoWidget, self).__init__()
self.setAcceptDrops(True)
self.installEventFilter(self)
Expand Down Expand Up @@ -239,6 +240,10 @@ def __init__(self, id, volume, cacheFolder, top=False, title='', resize=[], text
self.setTranslateFilter(self.textSetting[5]) # 同传过滤字符
self.textBrowser.optionWidget.translateFitler.setText(self.textSetting[5])
self.textBrowser.optionWidget.translateFitler.textChanged.connect(self.setTranslateFilter)
self.setFontSize(self.textSetting[6]) # 设置弹幕字体大小
self.textBrowser.optionWidget.fontSizeCombox.setCurrentIndex(self.textSetting[6])
self.textBrowser.optionWidget.fontSizeCombox.currentIndexChanged.connect(self.setFontSize)

self.textBrowser.closeSignal.connect(self.closeDanmu)
self.textBrowser.moveSignal.connect(self.moveTextBrowser)
if not self.startWithDanmu: # 如果启动隐藏被设置,隐藏弹幕机
Expand Down Expand Up @@ -351,15 +356,15 @@ def setHorizontalPercent(self, index): # 设置弹幕框水平宽度
self.horiPercent = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0][index] # 记录横向占比
width = self.width() * self.horiPercent
self.textBrowser.resize(width, self.textBrowser.height())
if width > 240:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 17, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 17, QFont.Bold))
elif 100 < width <= 240:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 5, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 5, QFont.Bold))
else:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 10, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 10, QFont.Bold))
# if width > 240:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 17, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 17, QFont.Bold))
# elif 100 < width <= 240:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 5, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 5, QFont.Bold))
# else:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 10, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 10, QFont.Bold))
self.textBrowser.textBrowser.verticalScrollBar().setValue(100000000)
self.textBrowser.transBrowser.verticalScrollBar().setValue(100000000)
self.setDanmu.emit()
Expand Down Expand Up @@ -391,18 +396,24 @@ def setTranslateFilter(self, filterWords):
self.filters = filterWords.split(' ')
self.setDanmu.emit()

def setFontSize(self, index):
self.textSetting[6] = index
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', index + 5, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', index + 5, QFont.Bold))
self.setDanmu.emit()

def resizeEvent(self, QEvent):
width = self.width() * self.horiPercent
self.textBrowser.resize(width, self.height() * self.vertPercent)
if width > 300:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 16, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 16, QFont.Bold))
elif 240 < width <= 300:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 1, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 1, QFont.Bold))
else:
self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 12, QFont.Bold))
self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 12, QFont.Bold))
# if width > 300:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 16, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 16, QFont.Bold))
# elif 240 < width <= 300:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 1, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', width // 20 + 1, QFont.Bold))
# else:
# self.textBrowser.textBrowser.setFont(QFont('Microsoft JhengHei', 12, QFont.Bold))
# self.textBrowser.transBrowser.setFont(QFont('Microsoft JhengHei', 12, QFont.Bold))
self.textBrowser.textBrowser.verticalScrollBar().setValue(100000000)
self.textBrowser.transBrowser.verticalScrollBar().setValue(100000000)
self.moveTextBrowser()
Expand Down
27 changes: 16 additions & 11 deletions danmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,41 @@ def __init__(self, icon):


class TextOpation(QWidget):
def __init__(self, setting=[20, 1, 7, 0, '【 [ {']):
def __init__(self, setting=[20, 1, 7, 0, '【 [ {', 10]):
super(TextOpation, self).__init__()
self.resize(300, 300)
self.setWindowTitle('弹幕窗设置')
self.setWindowFlag(Qt.WindowStaysOnTopHint)
layout = QGridLayout(self)
layout.addWidget(QLabel('窗体透明度'), 0, 0, 1, 1)
layout.addWidget(QLabel('字体大小'), 0, 0, 1, 1)
self.fontSizeCombox = QComboBox()
self.fontSizeCombox.addItems([str(i) for i in range(5, 26)])
self.fontSizeCombox.setCurrentIndex(setting[5])
layout.addWidget(self.fontSizeCombox, 0, 1, 1, 1)
layout.addWidget(QLabel('窗体透明度'), 1, 0, 1, 1)
self.opacitySlider = Slider()
self.opacitySlider.setValue(setting[0])
layout.addWidget(self.opacitySlider, 0, 1, 1, 1)
layout.addWidget(QLabel('窗体横向占比'), 1, 0, 1, 1)
layout.addWidget(self.opacitySlider, 1, 1, 1, 1)
layout.addWidget(QLabel('窗体横向占比'), 2, 0, 1, 1)
self.horizontalCombobox = QComboBox()
self.horizontalCombobox.addItems(['%d' % x + '%' for x in range(10, 110, 10)])
self.horizontalCombobox.setCurrentIndex(setting[1])
layout.addWidget(self.horizontalCombobox, 1, 1, 1, 1)
layout.addWidget(QLabel('窗体纵向占比'), 2, 0, 1, 1)
layout.addWidget(self.horizontalCombobox, 2, 1, 1, 1)
layout.addWidget(QLabel('窗体纵向占比'), 3, 0, 1, 1)
self.verticalCombobox = QComboBox()
self.verticalCombobox.addItems(['%d' % x + '%' for x in range(10, 110, 10)])
self.verticalCombobox.setCurrentIndex(setting[2])
layout.addWidget(self.verticalCombobox, 2, 1, 1, 1)
layout.addWidget(QLabel('弹幕窗类型'), 3, 0, 1, 1)
layout.addWidget(self.verticalCombobox, 3, 1, 1, 1)
layout.addWidget(QLabel('弹幕窗类型'), 4, 0, 1, 1)
self.translateCombobox = QComboBox()
self.translateCombobox.addItems(['弹幕和同传', '只显示弹幕', '只显示同传'])
self.translateCombobox.setCurrentIndex(setting[3])
layout.addWidget(self.translateCombobox, 3, 1, 1, 1)
layout.addWidget(QLabel('同传过滤字符 (空格隔开)'), 4, 0, 1, 1)
layout.addWidget(self.translateCombobox, 4, 1, 1, 1)
layout.addWidget(QLabel('同传过滤字符 (空格隔开)'), 5, 0, 1, 1)
self.translateFitler = QLineEdit('')
self.translateFitler.setText(setting[4])
self.translateFitler.setFixedWidth(100)
layout.addWidget(self.translateFitler, 4, 1, 1, 1)
layout.addWidget(self.translateFitler, 5, 1, 1, 1)


class TextBrowser(QWidget):
Expand Down
2 changes: 1 addition & 1 deletion pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self):

self.thankToBoss = thankToBoss()
self.thankToBoss.bossList.connect(self.updateBossList)
self.thankToBoss.start()
# self.thankToBoss.start()

def updateQR(self, img):
self.QR.setPixmap(img)
Expand Down
1 change: 1 addition & 0 deletions utils/vtb.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ v猫诺v,308543,个人势
月隐空夜,21292831,个人势
sunyeojin,6632844,个人势
南宫灯official,664481,个人势
入間綠,22461463,个人势
,,
Overidea_China,704808,Overidea
,,
Expand Down

0 comments on commit 54ab63e

Please sign in to comment.