mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 04:32:32 +00:00
NEW - [Webhooks] Show series, movie, or artist cover photos in incoming system notifications - [Webhooks/Radarr] Jump directly into the content by tapping the notification - [Webhooks/Sonarr] Jump directly into the content by tapping the notification - [-arr/Details] Added a button to the AppBar to jump directly into the edit page TWEAKS - [Radarr/Files] Moved the video block above the audio block FIXES - [AppBar/Dropdown] Vertical padding around title when the profile dropdown is visible was incorrect - [Radarr/Details] If the movie was not found, it would show an infinite loader, now shows a "No Movies Found" message - [Radarr/Releases] Changing the sorting or filter method would not scroll the list back to the top
67 lines
1.9 KiB
Dart
67 lines
1.9 KiB
Dart
import 'package:lunasea/core.dart';
|
|
//import 'package:lunasea/modules/Lidarr.dart';
|
|
|
|
class LidarrWebhooks extends LunaWebhooks {
|
|
@override
|
|
Future<void> handle(Map<dynamic, dynamic> data) async {
|
|
_EventType event = _EventType.GRAB.fromKey(data['event']);
|
|
if(event == null) LunaLogger().warning(
|
|
'LidarrWebhooks',
|
|
'handle',
|
|
'Unknown event type: ${data['event'] ?? 'null'}',
|
|
);
|
|
event?.execute(data);
|
|
}
|
|
}
|
|
|
|
enum _EventType {
|
|
DOWNLOAD,
|
|
GRAB,
|
|
RENAME,
|
|
RETAG,
|
|
TEST,
|
|
}
|
|
|
|
extension _EventTypeExtension on _EventType {
|
|
_EventType fromKey(String key) {
|
|
switch(key) {
|
|
case 'Download': return _EventType.DOWNLOAD;
|
|
case 'Grab': return _EventType.GRAB;
|
|
case 'Rename': return _EventType.RENAME;
|
|
case 'Retag': return _EventType.RETAG;
|
|
case 'Test': return _EventType.TEST;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
Future<void> execute(Map<dynamic, dynamic> data) async {
|
|
switch(this) {
|
|
case _EventType.DOWNLOAD: return _downloadEvent(data);
|
|
case _EventType.GRAB: return _grabEvent(data);
|
|
case _EventType.RENAME: return _renameEvent(data);
|
|
case _EventType.RETAG: return _retagEvent(data);
|
|
case _EventType.TEST: return _testEvent(data);
|
|
}
|
|
}
|
|
|
|
Future<void> _downloadEvent(Map<dynamic, dynamic> data) async {
|
|
return LunaModule.LIDARR.launch();
|
|
}
|
|
|
|
Future<void> _grabEvent(Map<dynamic, dynamic> data) async {
|
|
return LunaModule.LIDARR.launch();
|
|
}
|
|
|
|
Future<void> _renameEvent(Map<dynamic, dynamic> data) async {
|
|
return LunaModule.LIDARR.launch();
|
|
}
|
|
|
|
Future<void> _retagEvent(Map<dynamic, dynamic> data) async {
|
|
return LunaModule.LIDARR.launch();
|
|
}
|
|
|
|
Future<void> _testEvent(Map<dynamic, dynamic> data) async {
|
|
return LunaModule.LIDARR.launch();
|
|
}
|
|
}
|