|
|
|
|
@ -15,6 +15,54 @@ import 'package:multimedia/data/tvshows.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:multimedia/constants.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String convertState(String state) {
|
|
|
|
|
List<String> stateList = state.split(',');
|
|
|
|
|
int maxEpisode = 0;
|
|
|
|
|
Map stateListMap = {};
|
|
|
|
|
|
|
|
|
|
for (var x = 0; x < stateList.length; x++) {
|
|
|
|
|
List<String> tmp = stateList[x].split('|');
|
|
|
|
|
stateListMap[tmp[0]] = tmp[1];
|
|
|
|
|
|
|
|
|
|
int episode = int.parse(tmp[0]);
|
|
|
|
|
if (episode > maxEpisode) {
|
|
|
|
|
maxEpisode = episode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String stateString = "";
|
|
|
|
|
|
|
|
|
|
for (int x = 0; x < maxEpisode; x++) {
|
|
|
|
|
String s = '0';
|
|
|
|
|
int key = x + 1;
|
|
|
|
|
|
|
|
|
|
if (stateListMap.containsKey('$key')) {
|
|
|
|
|
s = stateListMap['$key'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stateString = stateString + s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stateString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DataGridCell> setSeasonData(int maxSeason, List<Season> seasonList) {
|
|
|
|
|
List<DataGridCell> dataGridCell = [];
|
|
|
|
|
int length = seasonList.length;
|
|
|
|
|
|
|
|
|
|
for (int x = 1; x <= maxSeason; x++) {
|
|
|
|
|
String status = '';
|
|
|
|
|
|
|
|
|
|
if (x <= length) {
|
|
|
|
|
status = convertState(seasonList[x - 1].state);
|
|
|
|
|
}
|
|
|
|
|
dataGridCell.add(DataGridCell(columnName: 'season$x', value: status));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dataGridCell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class TVShowsScreen extends StatefulWidget {
|
|
|
|
|
const TVShowsScreen({
|
|
|
|
|
super.key,
|
|
|
|
|
@ -195,7 +243,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
|
|
|
|
_columns = getColumns();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showTVShowDetails(int index) {
|
|
|
|
|
Future<void> showTVShowDetails(int index) async {
|
|
|
|
|
List<DataGridCell<dynamic>> cells =
|
|
|
|
|
tvshowDataSource.effectiveRows.elementAt(index).getCells();
|
|
|
|
|
|
|
|
|
|
@ -211,11 +259,43 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
final t = await Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (ctx) =>
|
|
|
|
|
TVShowDetailsScreen(tvShow: _tvshowsList[tvShowIndex])));
|
|
|
|
|
|
|
|
|
|
if (t != null) {
|
|
|
|
|
_tvshowsList[tvShowIndex].seriesName = t.seriesName;
|
|
|
|
|
_tvshowsList[tvShowIndex].download = t.download;
|
|
|
|
|
_tvshowsList[tvShowIndex].localPath = t.localPath;
|
|
|
|
|
_tvshowsList[tvShowIndex].resolution = t.resolution;
|
|
|
|
|
_tvshowsList[tvShowIndex].cliffhanger = t.cliffhanger;
|
|
|
|
|
_tvshowsList[tvShowIndex].seasonStatus = t.seasonStatus;
|
|
|
|
|
_tvshowsList[tvShowIndex].seriesState = t.seriesState;
|
|
|
|
|
TVShow e = _tvshowsList[tvShowIndex];
|
|
|
|
|
|
|
|
|
|
tvshowDataSource._tvshowDataGridRows[index] = DataGridRow(cells: [
|
|
|
|
|
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
|
|
|
|
|
DataGridCell<int>(columnName: 'seriesState', value: e.seriesState),
|
|
|
|
|
DataGridCell<String>(columnName: 'status', value: e.status),
|
|
|
|
|
DataGridCell<int>(columnName: 'cliffhanger', value: e.cliffhanger),
|
|
|
|
|
DataGridCell<String>(
|
|
|
|
|
columnName: 'backdropPath', value: e.backdropPath),
|
|
|
|
|
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
|
|
|
|
DataGridCell<String>(columnName: 'seriesName', value: e.seriesName),
|
|
|
|
|
DataGridCell<String>(
|
|
|
|
|
columnName: 'firstAired',
|
|
|
|
|
value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
|
|
|
|
|
DataGridCell<String>(columnName: 'resolution', value: e.resolution),
|
|
|
|
|
...setSeasonData(maxSeason, e.seasonStatus),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
for (int i = 0;i < _columns.length;i++) {
|
|
|
|
|
tvshowDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, i));
|
|
|
|
|
}
|
|
|
|
|
} else {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -275,53 +355,6 @@ class TVShowDataSource extends DataGridSource {
|
|
|
|
|
buildDataGridRow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String convertState(String state) {
|
|
|
|
|
List<String> stateList = state.split(',');
|
|
|
|
|
int maxEpisode = 0;
|
|
|
|
|
Map stateListMap = {};
|
|
|
|
|
|
|
|
|
|
for (var x = 0; x < stateList.length; x++) {
|
|
|
|
|
List<String> tmp = stateList[x].split('|');
|
|
|
|
|
stateListMap[tmp[0]] = tmp[1];
|
|
|
|
|
|
|
|
|
|
int episode = int.parse(tmp[0]);
|
|
|
|
|
if (episode > maxEpisode) {
|
|
|
|
|
maxEpisode = episode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String stateString = "";
|
|
|
|
|
|
|
|
|
|
for (int x = 0; x < maxEpisode; x++) {
|
|
|
|
|
String s = '0';
|
|
|
|
|
int key = x + 1;
|
|
|
|
|
|
|
|
|
|
if (stateListMap.containsKey('$key')) {
|
|
|
|
|
s = stateListMap['$key'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stateString = stateString + s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stateString;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DataGridCell> setSeasonData(int maxSeason, List<Season> seasonList) {
|
|
|
|
|
List<DataGridCell> dataGridCell = [];
|
|
|
|
|
int length = seasonList.length;
|
|
|
|
|
|
|
|
|
|
for (int x = 1; x <= maxSeason; x++) {
|
|
|
|
|
String status = '';
|
|
|
|
|
|
|
|
|
|
if (x <= length) {
|
|
|
|
|
status = convertState(seasonList[x - 1].state);
|
|
|
|
|
}
|
|
|
|
|
dataGridCell.add(DataGridCell(columnName: 'season$x', value: status));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dataGridCell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void buildDataGridRow() {
|
|
|
|
|
_tvshowDataGridRows = tvshows
|
|
|
|
|
.map<DataGridRow>((e) => DataGridRow(cells: [
|
|
|
|
|
@ -466,4 +499,8 @@ class TVShowDataSource extends DataGridSource {
|
|
|
|
|
void updateDataGrid() {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updateDataGridSource({required RowColumnIndex rowColumnIndex}) {
|
|
|
|
|
notifyDataSourceListeners(rowColumnIndex: rowColumnIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|