Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
sharl committed Feb 15, 2024
1 parent 15e0cc4 commit babb0fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 3 additions & 5 deletions sapporo_dhp.1m.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# -*- coding: utf-8 -*-
# METADATA
# <xbar.title>札幌 消防出動情報</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.version>v1.1</xbar.version>
# <xbar.author>Sharl Morlaroll</xbar.author>
# <xbar.author.github>sharl</xbar.author.github>
# <xbar.desc>アメダス地点の最新データを表示します</xbar.desc>
# <xbar.desc></xbar.desc>
# <xbar.dependencies>python3.11+, requests</xbar.dependencies>
# <swiftbar.hideAbout>true</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar>

import os
import re
Expand All @@ -38,5 +38,3 @@

if lines:
print('\n'.join(lines))
else:
print(MARK)
10 changes: 4 additions & 6 deletions yokohama_dhp.1m.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# METADATA
# <xbar.title>横浜 消防出動情報</xbar.title>
# <xbar.version>v1.1</xbar.version>
# <xbar.version>v1.2</xbar.version>
# <xbar.author>Sharl Morlaroll</xbar.author>
# <xbar.author.github>sharl</xbar.author.github>
# <xbar.desc></xbar.desc>
Expand All @@ -11,7 +11,7 @@
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar>

import os
import re
Expand All @@ -30,13 +30,11 @@
content = r.content.decode('utf-8')
m = re.search(r'(?s)<font size=2 color=black >.*?<hr.*?>', content)
if m:
match = re.sub(r'で発生した..に、.*?等が出場しています。', '', re.sub(r'<.*?>', '', m[0]).replace('\u3000', '').replace('\r', ''))
match = re.sub(r'で発生した.*?に、.*?等が出場しています。', '', re.sub(r'<.*?>', '', m[0]).replace('\u3000', '').replace('\r', ''))
lines = []
for line in match.split('\n'):
if line:
if line and line != 'こちらは横浜市消防局です。ただいま市内に火災等は発生しておりません。':
lines.append(MARK + line + f' | color={textcolor} terminal=false bash=open param1={URL}')

if lines:
print('\n'.join(lines))
else:
print(MARK)

0 comments on commit babb0fd

Please sign in to comment.