mirror of
https://github.com/stonega/tsacdop
synced 2025-02-10 00:20:49 +01:00
Release v0.3.4
This commit is contained in:
parent
4d49bf086e
commit
bbd9df64df
@ -56,6 +56,10 @@ If no api key added, the search function in the app won't work. But you can stil
|
|||||||
|
|
||||||
Share_key is used for generate clip.
|
Share_key is used for generate clip.
|
||||||
|
|
||||||
|
## Known Issue
|
||||||
|
|
||||||
|
- Playlist unstable
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
This project is a starting point for a Flutter application.
|
||||||
|
@ -99,6 +99,8 @@ class _DownloadListState extends State<DownloadList> {
|
|||||||
color: Colors.red),
|
color: Colors.red),
|
||||||
child: Text(
|
child: Text(
|
||||||
tasks[index].progress.toString() + '%',
|
tasks[index].progress.toString() + '%',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
maxLines: 1,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
))
|
))
|
||||||
: Container(),
|
: Container(),
|
||||||
@ -115,10 +117,7 @@ class _DownloadListState extends State<DownloadList> {
|
|||||||
backgroundImage: FileImage(
|
backgroundImage: FileImage(
|
||||||
File("${tasks[index].episode.imagePath}")),
|
File("${tasks[index].episode.imagePath}")),
|
||||||
),
|
),
|
||||||
trailing: Container(
|
trailing: _downloadButton(tasks[index], context),
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: _downloadButton(tasks[index], context)),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: tasks.length,
|
childCount: tasks.length,
|
||||||
|
@ -40,16 +40,16 @@ class Import extends StatelessWidget {
|
|||||||
if (autoDownloadNetwork == 1) {
|
if (autoDownloadNetwork == 1) {
|
||||||
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
||||||
// For safety
|
// For safety
|
||||||
if (episodes.length < 100)
|
if (episodes.length < 100 && episodes.length > 0)
|
||||||
episodes.forEach((episode) {
|
episodes.forEach((episode) async {
|
||||||
downloader.startTask(episode, showNotification: true);
|
await downloader.startTask(episode, showNotification: true);
|
||||||
});
|
});
|
||||||
} else if (result == ConnectivityResult.wifi) {
|
} else if (result == ConnectivityResult.wifi) {
|
||||||
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
||||||
//For safety
|
//For safety
|
||||||
if (episodes.length < 100)
|
if (episodes.length < 100 && episodes.length > 0)
|
||||||
episodes.forEach((episode) {
|
episodes.forEach((episode) async {
|
||||||
downloader.startTask(episode, showNotification: true);
|
await downloader.startTask(episode, showNotification: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ class _SlideIntroState extends State<SlideIntro> {
|
|||||||
SlideLeftRoute(page: Home()));
|
SlideLeftRoute(page: Home()));
|
||||||
Provider.of<SettingState>(context,
|
Provider.of<SettingState>(context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.saveShowIntro();
|
.saveShowIntro(1);
|
||||||
} else if (widget.goto == Goto.settings) {
|
} else if (widget.goto == Goto.settings) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
|
@ -1010,6 +1010,7 @@ class DBHelper {
|
|||||||
await txn.rawUpdate(
|
await txn.rawUpdate(
|
||||||
"UPDATE Episodes SET is_new = 0 WHERE enclosure_url = ?", [url]);
|
"UPDATE Episodes SET is_new = 0 WHERE enclosure_url = ?", [url]);
|
||||||
});
|
});
|
||||||
|
print('remove new episode');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EpisodeBrief>> getLikedRssItem(int i, int sortBy) async {
|
Future<List<EpisodeBrief>> getLikedRssItem(int i, int sortBy) async {
|
||||||
|
@ -43,7 +43,6 @@ class _DownloadsManageState extends State<DownloadsManage> {
|
|||||||
_size = 0;
|
_size = 0;
|
||||||
_fileNum = 0;
|
_fileNum = 0;
|
||||||
var dir = await getExternalStorageDirectory();
|
var dir = await getExternalStorageDirectory();
|
||||||
print(dir.path);
|
|
||||||
dir.list().forEach((d) {
|
dir.list().forEach((d) {
|
||||||
var fileDir = Directory(d.path);
|
var fileDir = Directory(d.path);
|
||||||
fileDir.list().forEach((file) async {
|
fileDir.list().forEach((file) async {
|
||||||
@ -124,7 +123,7 @@ class _DownloadsManageState extends State<DownloadsManage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20),
|
padding: const EdgeInsets.only(left: 10),
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: 'Total ',
|
text: 'Total ',
|
||||||
@ -150,7 +149,9 @@ class _DownloadsManageState extends State<DownloadsManage> {
|
|||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
)),
|
)),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: (_size ~/ 1000000).toString(),
|
text: (_size ~/ 1000000) < 1000
|
||||||
|
? (_size ~/ 1000000).toString()
|
||||||
|
: (_size / 1000000000).toStringAsFixed(1),
|
||||||
style: GoogleFonts.cairo(
|
style: GoogleFonts.cairo(
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: Theme.of(context).accentColor,
|
||||||
@ -158,7 +159,9 @@ class _DownloadsManageState extends State<DownloadsManage> {
|
|||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: ' Mb',
|
text: (_size ~/ 1000000) < 1000
|
||||||
|
? 'Mb'
|
||||||
|
: 'Gb',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: Theme.of(context).accentColor,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
|
@ -222,7 +222,8 @@ class _StorageSettingState extends State<StorageSetting>
|
|||||||
onChanged: (value) async {
|
onChanged: (value) async {
|
||||||
await _setAutoDeleteDays(value);
|
await _setAutoDeleteDays(value);
|
||||||
},
|
},
|
||||||
items: <int>[-1, 10, 30]
|
//TODO remove 1 before release
|
||||||
|
items: <int>[-1, 5, 10, 15, 30]
|
||||||
.map<DropdownMenuItem<int>>((e) {
|
.map<DropdownMenuItem<int>>((e) {
|
||||||
return DropdownMenuItem<int>(
|
return DropdownMenuItem<int>(
|
||||||
value: e,
|
value: e,
|
||||||
|
@ -113,7 +113,9 @@ class Playlist {
|
|||||||
|
|
||||||
Future<int> delFromPlaylist(EpisodeBrief episodeBrief) async {
|
Future<int> delFromPlaylist(EpisodeBrief episodeBrief) async {
|
||||||
int index = _playlist.indexOf(episodeBrief);
|
int index = _playlist.indexOf(episodeBrief);
|
||||||
_playlist.removeWhere((episode) => episode == episodeBrief);
|
_playlist.removeWhere(
|
||||||
|
(episode) => episode.enclosureUrl == episodeBrief.enclosureUrl);
|
||||||
|
print('delete' + episodeBrief.title);
|
||||||
await savePlaylist();
|
await savePlaylist();
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -244,6 +246,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
episodeLoad(EpisodeBrief episode, {int startPosition = 0}) async {
|
episodeLoad(EpisodeBrief episode, {int startPosition = 0}) async {
|
||||||
|
print(episode.enclosureUrl);
|
||||||
final EpisodeBrief episodeNew =
|
final EpisodeBrief episodeNew =
|
||||||
await dbHelper.getRssItemWithUrl(episode.enclosureUrl);
|
await dbHelper.getRssItemWithUrl(episode.enclosureUrl);
|
||||||
//TODO load episode from last position when player running
|
//TODO load episode from last position when player running
|
||||||
@ -270,8 +273,9 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
//await _queue.savePlaylist();
|
//await _queue.savePlaylist();
|
||||||
_startAudioService(startPosition, episodeNew.enclosureUrl);
|
_startAudioService(startPosition, episodeNew.enclosureUrl);
|
||||||
if (episodeNew.isNew == 1)
|
if (episodeNew.isNew == 1) {
|
||||||
dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
await dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,15 +50,15 @@ class AutoDownloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindBackgroundIsolate() {
|
bindBackgroundIsolate() {
|
||||||
print('start listen');
|
|
||||||
ReceivePort _port = ReceivePort();
|
ReceivePort _port = ReceivePort();
|
||||||
bool isSuccess = IsolateNameServer.registerPortWithName(
|
bool isSuccess = IsolateNameServer.registerPortWithName(
|
||||||
_port.sendPort, 'auto_downloader_send_port');
|
_port.sendPort, 'auto_downloader_send_port');
|
||||||
if (!isSuccess) {
|
if (!isSuccess) {
|
||||||
_unbindBackgroundIsolate();
|
IsolateNameServer.removePortNameMapping('auto_downloader_send_port');
|
||||||
//bindBackgroundIsolate();
|
bindBackgroundIsolate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
print('start listen');
|
||||||
_port.listen((dynamic data) {
|
_port.listen((dynamic data) {
|
||||||
String id = data[0];
|
String id = data[0];
|
||||||
DownloadTaskStatus status = data[1];
|
DownloadTaskStatus status = data[1];
|
||||||
@ -102,7 +102,7 @@ class AutoDownloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future startTask(List<EpisodeBrief> episodes,
|
Future startTask(List<EpisodeBrief> episodes,
|
||||||
{bool showNotification = true}) async {
|
{bool showNotification = false}) async {
|
||||||
episodes.forEach((episode) async {
|
episodes.forEach((episode) async {
|
||||||
final dir = await getExternalStorageDirectory();
|
final dir = await getExternalStorageDirectory();
|
||||||
String localPath = path.join(dir.path, episode.feedTitle);
|
String localPath = path.join(dir.path, episode.feedTitle);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:isolate';
|
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:connectivity/connectivity.dart';
|
import 'package:connectivity/connectivity.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@ -28,7 +27,7 @@ void callbackDispatcher() {
|
|||||||
});
|
});
|
||||||
await FlutterDownloader.initialize();
|
await FlutterDownloader.initialize();
|
||||||
AutoDownloader downloader = AutoDownloader();
|
AutoDownloader downloader = AutoDownloader();
|
||||||
downloader.bindBackgroundIsolate();
|
|
||||||
KeyValueStorage autoDownloadStorage =
|
KeyValueStorage autoDownloadStorage =
|
||||||
KeyValueStorage(autoDownloadNetworkKey);
|
KeyValueStorage(autoDownloadNetworkKey);
|
||||||
int autoDownloadNetwork = await autoDownloadStorage.getInt();
|
int autoDownloadNetwork = await autoDownloadStorage.getInt();
|
||||||
@ -36,13 +35,17 @@ void callbackDispatcher() {
|
|||||||
if (autoDownloadNetwork == 1) {
|
if (autoDownloadNetwork == 1) {
|
||||||
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
||||||
// For safety
|
// For safety
|
||||||
if (episodes.length < 100 && episodes.length > 0)
|
if (episodes.length < 100 && episodes.length > 0) {
|
||||||
|
downloader.bindBackgroundIsolate();
|
||||||
await downloader.startTask(episodes);
|
await downloader.startTask(episodes);
|
||||||
|
}
|
||||||
} else if (result == ConnectivityResult.wifi) {
|
} else if (result == ConnectivityResult.wifi) {
|
||||||
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
List<EpisodeBrief> episodes = await dbHelper.getNewEpisodes('all');
|
||||||
//For safety
|
//For safety
|
||||||
if (episodes.length < 100 && episodes.length > 0)
|
if (episodes.length < 100 && episodes.length > 0) {
|
||||||
|
downloader.bindBackgroundIsolate();
|
||||||
await downloader.startTask(episodes);
|
await downloader.startTask(episodes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await lastWorkStorage.saveInt(1);
|
await lastWorkStorage.saveInt(1);
|
||||||
KeyValueStorage refreshstorage = KeyValueStorage(refreshdateKey);
|
KeyValueStorage refreshstorage = KeyValueStorage(refreshdateKey);
|
||||||
@ -149,6 +152,7 @@ class SettingState extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _initialShowIntor;
|
||||||
bool _showIntro;
|
bool _showIntro;
|
||||||
bool get showIntro => _showIntro;
|
bool get showIntro => _showIntro;
|
||||||
|
|
||||||
@ -163,13 +167,18 @@ class SettingState extends ChangeNotifier {
|
|||||||
@override
|
@override
|
||||||
void addListener(VoidCallback listener) {
|
void addListener(VoidCallback listener) {
|
||||||
super.addListener(listener);
|
super.addListener(listener);
|
||||||
_getTheme();
|
|
||||||
_getAccentSetColor();
|
|
||||||
_getAutoUpdate();
|
_getAutoUpdate();
|
||||||
_getRealDark();
|
|
||||||
_getDownloadUsingData();
|
_getDownloadUsingData();
|
||||||
_getUpdateInterval().then((value) {
|
_getUpdateInterval().then((value) async {
|
||||||
if (_initUpdateTag == 0) setWorkManager(24);
|
if (_initUpdateTag == 0)
|
||||||
|
setWorkManager(24);
|
||||||
|
//Restart worker if anythin changed in worker callback.
|
||||||
|
//varsion 2 add auto download new episodes
|
||||||
|
else if (_autoUpdate && _initialShowIntor == 1) {
|
||||||
|
await cancelWork();
|
||||||
|
setWorkManager(_initUpdateTag);
|
||||||
|
await saveShowIntro(2);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,12 +234,12 @@ class SettingState extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future _getShowIntro() async {
|
Future _getShowIntro() async {
|
||||||
int i = await introStorage.getInt();
|
_initialShowIntor = await introStorage.getInt();
|
||||||
_showIntro = i == 0 ? true : false;
|
_showIntro = _initialShowIntor == 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future saveShowIntro() async {
|
Future saveShowIntro(int i) async {
|
||||||
await introStorage.saveInt(1);
|
await introStorage.saveInt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _getRealDark() async {
|
Future _getRealDark() async {
|
||||||
|
@ -83,11 +83,11 @@ class EpisodeBrief {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object episode) =>
|
bool operator == (Object episode) =>
|
||||||
episode is EpisodeBrief &&
|
episode is EpisodeBrief &&
|
||||||
episode.title == title &&
|
episode.title == title &&
|
||||||
episode.enclosureUrl == enclosureUrl;
|
episode.enclosureUrl == enclosureUrl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => enclosureUrl.hashCode;
|
int get hashCode => enclosureUrl.hashCode + title.hashCode;
|
||||||
}
|
}
|
||||||
|
@ -489,9 +489,9 @@ class EpisodeGrid extends StatelessWidget {
|
|||||||
// _listenIndicater(context,
|
// _listenIndicater(context,
|
||||||
// episode: episodes[index],
|
// episode: episodes[index],
|
||||||
// isListened: snapshot.data),
|
// isListened: snapshot.data),
|
||||||
|
_isNewIndicator(episodes[index]),
|
||||||
_downloadIndicater(context,
|
_downloadIndicater(context,
|
||||||
episode: episodes[index]),
|
episode: episodes[index]),
|
||||||
_isNewIndicator(episodes[index]),
|
|
||||||
_numberIndicater(context,
|
_numberIndicater(context,
|
||||||
index: index, color: _c)
|
index: index, color: _c)
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user