~mterry/podbird/ok

« back to all changes in this revision

Viewing changes to app/podcasts.js

  • Committer: Nekhelesh Ramananthan
  • Date: 2016-03-29 11:06:29 UTC
  • mfrom: (145.1.5 sync-to-trunk)
  • Revision ID: krnekhelesh@gmail.com-20160329110629-2bfccvf6r4exvydq
Syncs the following patches from trunk,
- Removed hardcoded colors in Light and Dark theme
- Fixed database upgrade from "",1.0 -> 1.2
- Changed icon from system-log-out back to delete

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        tx.executeSql('CREATE TABLE IF NOT EXISTS Queue(ind INTEGER NOT NULL, guid TEXT, image TEXT, name TEXT, artist TEXT, url TEXT)');
26
26
    });
27
27
 
28
 
    /*
29
 
     Schema Upgrade to v1.2 which adds a new favourited boolean variable which is needed to track the favourite status
30
 
     of an episode.
31
 
    */
32
 
    if (db.version != "1.2") {
33
 
        console.log("Upgrading database from %1 -> v1.2".arg(db.version))
34
 
        db.changeVersion(db.version, "1.2", function(tx) {
35
 
            tx.executeSql('ALTER TABLE Episode ADD favourited BOOLEAN');
36
 
            tx.executeSql('UPDATE Episode SET favourited=?', [false]);
37
 
        });
 
28
    try {
 
29
        /*
 
30
        Schema Upgrade to v1.1 which adds a new queued boolean variable which is needed to track the queued status
 
31
        of a episode properly.
 
32
        */
 
33
        if (db.version === "1.0" || db.version === "") {
 
34
            console.log("Upgrading database from %1 -> v1.1".arg(db.version))
 
35
            db.changeVersion(db.version, "1.1", function(tx) {
 
36
                tx.executeSql('ALTER TABLE Episode ADD queued BOOLEAN');
 
37
                tx.executeSql('UPDATE Episode SET queued=0');
 
38
            });
 
39
        }
 
40
 
 
41
        /*
 
42
        Schema Upgrade to v1.2 which adds a new favourited boolean variable which is needed to track the favourite status
 
43
        of an episode.
 
44
        */
 
45
        if (db.version === "1.1") {
 
46
            console.log("Upgrading database from %1 -> v1.2".arg(db.version))
 
47
            db.changeVersion("1.1", "1.2", function(tx) {
 
48
                tx.executeSql('ALTER TABLE Episode ADD favourited BOOLEAN');
 
49
                tx.executeSql('UPDATE Episode SET favourited=?', [false]);
 
50
            });
 
51
        }
 
52
    } catch(ex) {
 
53
        console.log(ex)
38
54
    }
39
55
 
40
56
    return db;
212
228
                                                var ers = tx2.executeSql("SELECT rowid FROM Episode WHERE guid=?", [track.guid]);
213
229
                                                if (ers.rows.length === 0) {
214
230
                                                    tx2.executeSql("INSERT INTO Episode(podcast, name, description, audiourl, guid, listened, queued, favourited, duration, published) VALUES(?, ?, ? , ?, ?, ?, ?, ?, ?, ?)", [pid,
215
 
                                                                                                                                                                                                                 track.name,
216
 
                                                                                                                                                                                                                 track.description,
217
 
                                                                                                                                                                                                                 track.audiourl,
218
 
                                                                                                                                                                                                                 track.guid,
219
 
                                                                                                                                                                                                                 false,
220
 
                                                                                                                                                                                                                 false,
221
 
                                                                                                                                                                                                                 false,
222
 
                                                                                                                                                                                                                 track.duration,
223
 
                                                                                                                                                                                                                 track.published]);
 
231
                                                                                                                                                                                                                                track.name,
 
232
                                                                                                                                                                                                                                track.description,
 
233
                                                                                                                                                                                                                                track.audiourl,
 
234
                                                                                                                                                                                                                                track.guid,
 
235
                                                                                                                                                                                                                                false,
 
236
                                                                                                                                                                                                                                false,
 
237
                                                                                                                                                                                                                                false,
 
238
                                                                                                                                                                                                                                track.duration,
 
239
                                                                                                                                                                                                                                track.published]);
224
240
                                                }
225
241
                                            });
226
242
                                        }