Skip to content

Commit e167582

Browse files
committed
Added app name change support
1 parent 7dfadb6 commit e167582

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ docker run -d \
198198
| `SERVARR_URL` | Servarr instance URL | Yes |
199199
| `API_KEY` | Servarr API key | Yes |
200200
| `WEBHOOK_URL` | TRMNL webhook URL | Yes |
201+
| `APP_NAME` | Display name for title bar (e.g., "TV Shows") | No (auto from app type) |
201202
| `INTERVAL` | Collection interval in seconds (0 = run once) | No (default: 0) |
202203
| `TZ` | Timezone for display | No (default: UTC) |
203204
| `APP_TYPE` | App type (sonarr/radarr/lidarr/readarr/prowlarr) | No (auto-detected) |
@@ -237,6 +238,7 @@ python trmnl_collector.py \
237238
| `-u, --url` | Servarr instance URL | Required (if no config) |
238239
| `-k, --api-key` | Servarr API key | Required (if no config) |
239240
| `-w, --webhook` | TRMNL webhook URL | None (prints to stdout) |
241+
| `-n, --name` | Display name for title bar (e.g., "TV Shows") | Auto from app type |
240242
| `-t, --type` | App type (sonarr/radarr/lidarr/readarr/prowlarr) | Auto-detected |
241243
| `-d, --days` | Calendar days forward | 7 |
242244
| `-b, --days-before` | Calendar days back | 0 |

collector/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ COPY config.example.yaml /app/
3535
ENV SERVARR_URL=""
3636
ENV API_KEY=""
3737
ENV WEBHOOK_URL=""
38+
ENV APP_NAME=""
3839
ENV APP_TYPE=""
3940
ENV CALENDAR_DAYS="7"
4041
ENV CALENDAR_DAYS_BEFORE="0"
@@ -66,6 +67,10 @@ if [[ -n "$WEBHOOK_URL" ]]; then
6667
ARGS="$ARGS -w $WEBHOOK_URL"
6768
fi
6869

70+
if [[ -n "$APP_NAME" ]]; then
71+
ARGS="$ARGS -n $APP_NAME"
72+
fi
73+
6974
if [[ -n "$APP_TYPE" ]]; then
7075
ARGS="$ARGS -t $APP_TYPE"
7176
fi

collector/trmnl_collector.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,16 @@ def collect(self) -> Dict[str, Any]:
592592
# Get timezone abbreviation for display
593593
tz_abbrev = self._get_timezone_abbrev()
594594

595+
# Use custom name if provided, otherwise use app type in title case
596+
display_name = self.name if self.name else app_type.capitalize()
597+
595598
# Build payload
596599
if self.calendar_only:
597600
# Calendar only mode - minimal payload
598601
calendar = self.fetch_calendar(app_type)
599602
payload = {
600603
'merge_variables': {
601-
'app_name': app_type.capitalize(),
604+
'app_name': display_name,
602605
'app_type': app_type,
603606
'last_updated': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
604607
'timezone': tz_abbrev,
@@ -615,7 +618,7 @@ def collect(self) -> Dict[str, Any]:
615618

616619
payload = {
617620
'merge_variables': {
618-
'app_name': app_type.capitalize(),
621+
'app_name': display_name,
619622
'app_type': app_type,
620623
'last_updated': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
621624
'timezone': tz_abbrev,
@@ -695,7 +698,7 @@ def create_collectors_from_config(config: Dict[str, Any], args: argparse.Namespa
695698
def create_collector_from_args(args: argparse.Namespace) -> ServarrCollector:
696699
"""Create a single collector from CLI arguments."""
697700
return ServarrCollector(
698-
name=args.type or 'servarr',
701+
name=args.name,
699702
url=args.url,
700703
api_key=args.api_key,
701704
webhook=args.webhook,
@@ -768,6 +771,7 @@ def main():
768771
parser.add_argument('-u', '--url', help='Servarr instance URL')
769772
parser.add_argument('-k', '--api-key', help='Servarr API key')
770773
parser.add_argument('-w', '--webhook', help='TRMNL webhook URL')
774+
parser.add_argument('-n', '--name', default='', help='Display name for title bar (default: auto from app type)')
771775
parser.add_argument('-t', '--type', help='App type (sonarr, radarr, lidarr, readarr, prowlarr)')
772776
parser.add_argument('-d', '--days', type=int, default=7, help='Calendar days forward (default: 7)')
773777
parser.add_argument('-b', '--days-before', type=int, default=0, help='Calendar days back (default: 0)')

0 commit comments

Comments
 (0)