Skip to content

Commit bbeaa71

Browse files
committed
fix: duplicate m3u urls
1 parent 685458a commit bbeaa71

File tree

8 files changed

+93
-21
lines changed

8 files changed

+93
-21
lines changed

lib/controllers/m3u_controller.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ class M3uController extends ChangeNotifier {
414414

415415
items.add(
416416
M3uItem(
417+
id: uuid.v4(),
417418
playlistId: playlistId,
418419
url: url,
419420
contentType: _detectContentType(url),

lib/controllers/m3u_home_controller.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ class M3UHomeController extends ChangeNotifier {
8080
case 0:
8181
return context.loc.history;
8282
case 1:
83-
return context.loc.live_streams;
83+
return context.loc.all;
8484
case 2:
85-
return context.loc.movies;
85+
return context.loc.live_streams;
8686
case 3:
87-
return context.loc.series_plural;
87+
return context.loc.movies;
8888
case 4:
89+
return context.loc.series_plural;
90+
case 5:
8991
return context.loc.settings;
9092
default:
9193
return 'Another IPTV Player';

lib/database/database.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ class WatchHistories extends Table {
323323

324324
@DataClassName('M3uItemData')
325325
class M3uItems extends Table {
326+
TextColumn get id => text()();
327+
326328
TextColumn get playlistId => text()();
327329

328330
TextColumn get url => text()();
@@ -358,12 +360,13 @@ class M3uItems extends Table {
358360
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
359361

360362
@override
361-
Set<Column> get primaryKey => {playlistId, url};
363+
Set<Column> get primaryKey => {id};
362364

363365
@override
364366
List<String> get customConstraints => [
367+
'CHECK (LENGTH(id) > 0)',
365368
'CHECK (LENGTH(url) > 0)',
366-
'CHECK (LENGTH(playlist_id) > 0)', // playlistId değil playlist_id!
369+
'CHECK (LENGTH(playlist_id) > 0)',
367370
];
368371
}
369372

@@ -453,7 +456,7 @@ class AppDatabase extends _$AppDatabase {
453456
);
454457

455458
@override
456-
int get schemaVersion => 5;
459+
int get schemaVersion => 6;
457460

458461
// === PLAYLIST İŞLEMLERİ ===
459462

@@ -1498,6 +1501,11 @@ class AppDatabase extends _$AppDatabase {
14981501
await m.createTable(m3uSeries);
14991502
await m.createTable(m3uEpisodes);
15001503
}
1504+
1505+
if (from <= 6) {
1506+
await m.deleteTable('m3u_items');
1507+
await m.createTable(m3uItems);
1508+
}
15011509
},
15021510
);
15031511

lib/database/database.g.dart

Lines changed: 64 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:another_iptv_player/controllers/playlist_controller.dart';
2+
import 'package:another_iptv_player/repositories/user_preferences.dart';
23
import 'package:another_iptv_player/screens/app_initializer_screen.dart';
34
import 'package:flutter/material.dart';
45
import 'package:another_iptv_player/services/service_locator.dart';

0 commit comments

Comments
 (0)