Fixing the database to sort of working again
This commit is contained in:
parent
8d60f07459
commit
c7c6065ca2
@ -9,6 +9,7 @@ Item {
|
||||
ready = false
|
||||
request(source, function (o) {
|
||||
//console.log(o.responseText);
|
||||
|
||||
simple = eval('new Object(' + o.responseText + ')');ready = true;
|
||||
});
|
||||
|
||||
|
@ -17,9 +17,9 @@ ListItem {
|
||||
|
||||
function getArrary(ent, model) {
|
||||
if (ent) {
|
||||
console.log("LEN: "+ent.count)
|
||||
// console.log("LEN: "+ent.count)
|
||||
for (var i = 0; i < ent.count; i ++) {
|
||||
console.log(ent.get(i))
|
||||
// console.log(ent.get(i))
|
||||
model.append(ent.get(i))
|
||||
}
|
||||
}
|
||||
@ -171,7 +171,7 @@ ListItem {
|
||||
MouseArea {
|
||||
anchors.fill: favIcon
|
||||
onClicked: if (getFav(model.id)) {showRemorseItem()} else {
|
||||
console.log("ID: "+model.id)
|
||||
// console.log("ID: "+model.id)
|
||||
var network
|
||||
model.webChannel ? network = model.webChannel.name : network = model.network.name
|
||||
addFav(model.id, model.name, showImg.source, model.summary, model.status, model.premiered, model.rating.average, network, model.updated, prev, next, nextse, model.externals.imdb);
|
||||
@ -310,7 +310,7 @@ ListItem {
|
||||
|
||||
Text {
|
||||
id: showNetwork
|
||||
text: model.webChannel ? model.webChannel.name : model.network.name
|
||||
text: model.network ? model.network.name : model.webChannel.name
|
||||
color: highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
wrapMode: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
@ -411,7 +411,7 @@ ListItem {
|
||||
onClicked: {
|
||||
//frompage === undefined ?
|
||||
var network
|
||||
model.webChannel ? network = model.webChannel.name : network = model.network.name
|
||||
model.network ? network = model.network.name : network = model.webChannel.name
|
||||
pageStack.push(Qt.resolvedUrl("../pages/InfoPage.qml"),
|
||||
{"showid": model.id,"showname": model.name, "showimage": showImg.source, "summary": model.summary, "showstatus": model.status, "showprem": model.premiered, "showrating": model.rating.average, "shownetwork": network, "showupdated": model.updated, "showprev": model.previousepisode, "shownext": model.nextepisode, "simdb": model.externals.imdb, "sofficial": model.officialSite})
|
||||
|
||||
|
@ -41,6 +41,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function addFav(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse, imdb, official) {
|
||||
//console.log(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse,imdb,official)
|
||||
FavDb.add(showid, name, image, summary, status, prem, rating, network, updated, previous, next, nextse,imdb,official)
|
||||
}
|
||||
|
||||
|
@ -4,25 +4,6 @@ var db = undefined;
|
||||
function settings_db_open() {
|
||||
if (db == undefined)
|
||||
db = LocalStorage.openDatabaseSync("harbour-labyrinth-test1", "1.0", "StorageDatabase", 100000);
|
||||
|
||||
/* db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql("DROP TABLE IF EXISTS favorites");
|
||||
}); */
|
||||
|
||||
|
||||
// drop()
|
||||
/* property string showname
|
||||
|
||||
property string showimage: ""
|
||||
property string summary: ""
|
||||
property string showid: ""
|
||||
|
||||
property string showstatus: ""
|
||||
property string showprem: ""
|
||||
property string showrating: ""
|
||||
property string shownetwork: "" */
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
@ -42,7 +23,7 @@ function initialize() { // klar
|
||||
function(tx) {
|
||||
|
||||
// tx.executeSql('ALTER TABLE favorites ADD seen INTEGER');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS favorites(showid INTEGER UNIQUE, name TEXT, image TEXT, summary TEXT, status TEXT, premiered TEXT, rating TEXT, network TEXT, updated INTEGER, previous TEXT, next TEXT,nextse TEXT, imdb TEXT, official TEXT, seen INTEGER)');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS favorites(showid INTEGER UNIQUE, name TEXT, image TEXT, summary TEXT, status TEXT, premiered TEXT, rating TEXT, network TEXT, updated INTEGER, previous TEXT, next TEXT,nextse TEXT, imdb TEXT, official TEXT)');
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS seen(showid INTEGER UNIQUE, season INTEGER, episode INTEGER)');
|
||||
// tx.executeSql('CREATE TABLE IF NOT EXISTS next(showid INTEGER UNIQUE, next TEXT)');
|
||||
// tx.executeSql('CREATE TABLE IF NOT EXISTS previous(showid INTEGER UNIQUE, prev TEXT)');
|
||||
@ -95,7 +76,7 @@ function getFav_(showid) {
|
||||
{
|
||||
try {
|
||||
tx.executeSql("SELECT * FROM favorites WHERE showid='"+showid+"'");
|
||||
console.log("SUCCESS")
|
||||
// console.log("SUCCESS")
|
||||
} catch(a) {
|
||||
console.log("ERROR")
|
||||
}
|
||||
@ -130,7 +111,7 @@ function load(model) // klar
|
||||
var rs = tx.executeSql('SELECT * FROM favorites ORDER BY name ASC, next');
|
||||
for(var i = 0; i < rs.rows.length; i++)
|
||||
{
|
||||
model.append({"showid" : rs.rows.item(i).showid, "name" : rs.rows.item(i).name,"image" : rs.rows.item(i).image,"summary" : rs.rows.item(i).summary,"status" : rs.rows.item(i).status,"premiered" : rs.rows.item(i).premiered,"rating" : rs.rows.item(i).rating,"network" : rs.rows.item(i).network,"updated" : rs.rows.item(i).updated,"prev" : rs.rows.item(i).previous,"next" : rs.rows.item(i).next, "nextse" : rs.rows.item(i).nextse, "imdb" : rs.rows.item(i).imdb, "official" : rs.rows.item(i).official, "seen" : rs.rows.item(i).seen})
|
||||
model.append({"showid" : rs.rows.item(i).showid, "name" : rs.rows.item(i).name,"image" : rs.rows.item(i).image,"summary" : rs.rows.item(i).summary,"status" : rs.rows.item(i).status,"premiered" : rs.rows.item(i).premiered,"rating" : rs.rows.item(i).rating,"network" : rs.rows.item(i).network,"updated" : rs.rows.item(i).updated,"prev" : rs.rows.item(i).previous,"next" : rs.rows.item(i).next, "nextse" : rs.rows.item(i).nextse, "imdb" : rs.rows.item(i).imdb, "official" : rs.rows.item(i).official})
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -148,7 +129,7 @@ function add(showid, name, image, summary, status, prem, rating, network, update
|
||||
}
|
||||
catch(a)
|
||||
{
|
||||
console.log("insert failed, probably already exists");
|
||||
console.log("add failed, probably already exists");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -168,7 +149,7 @@ function update(showid, name, image, summary, status, prem, rating, network, upd
|
||||
}
|
||||
catch(a)
|
||||
{
|
||||
console.log("insert failed, probably already exists");
|
||||
console.log("update failed, probably already exists");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -180,7 +161,7 @@ function updateNext(showid, next, nextse) // klar
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('UPDATE favorites SET next=?,nextse=? WHERE showid='+showid+';', [next, nextse])
|
||||
console.log("*** DB UPDATE NEXT: "+showid+" / "+next)
|
||||
// console.log("*** DB UPDATE NEXT: "+showid+" / "+next)
|
||||
});
|
||||
}
|
||||
|
||||
@ -190,7 +171,7 @@ function updatePrev(showid, prev) // klar
|
||||
db.transaction(function(tx)
|
||||
{
|
||||
tx.executeSql('UPDATE favorites SET previous=? WHERE showid='+showid+';', [prev])
|
||||
console.log("*** DB UPDATE PREV: "+showid+" / "+prev)
|
||||
// console.log("*** DB UPDATE PREV: "+showid+" / "+prev)
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -117,12 +117,12 @@ Page {
|
||||
property string nese: ""
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
console.log(" ---- UPDATING NEXTSHOW")
|
||||
// console.log(" ---- UPDATING NEXTSHOW")
|
||||
simple.airdate ? ne = simple.airdate : ne = "?"
|
||||
ne !== "?" ? nese = "S"+simple.season+"E"+simple.number : nese = ""
|
||||
f_next = ne
|
||||
f_nextse = nese
|
||||
console.log(f_name+" has been updated. ")
|
||||
// console.log(f_name+" has been updated. ")
|
||||
updateNext(showid, ne, nese)
|
||||
notification.summary = f_name
|
||||
notification.subText = "Labyrinth"
|
||||
@ -142,7 +142,7 @@ Page {
|
||||
property string pr: ""
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
console.log(" ---- UPDATING PREVSHOW")
|
||||
// console.log(" ---- UPDATING PREVSHOW")
|
||||
simple.airdate ? pr = simple.airdate : pr = "?"
|
||||
f_prev = pr
|
||||
updatePrev(showid, pr)
|
||||
|
@ -362,7 +362,7 @@ Page {
|
||||
text: qsTr("Open IMDB page")
|
||||
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
//WebViewer {webPageAddress: defaultDevice }
|
||||
console.log("IMDB: "+simdb)
|
||||
// console.log("IMDB: "+simdb)
|
||||
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": "http://m.imdb.com/title/"+simdb} )
|
||||
}
|
||||
}
|
||||
@ -371,7 +371,7 @@ Page {
|
||||
text: qsTr("Official site")
|
||||
onClicked: { //remorse.execute(qsTr("Opening webpage"), function() {Qt.openUrlExternally("http://m.imdb.com/title/"+simdb)}, 2000)//Qt.openUrlExternally("http://m.imdb.com/title/"+imdb)//pageStack.push(Qt.resolvedUrl("SeasonsPage.qml"),{"showid": showid,"showname": showname,"showimage": showimage} )
|
||||
//WebViewer {webPageAddress: defaultDevice }
|
||||
console.log("Official: "+sofficial)
|
||||
// console.log("Official: "+sofficial)
|
||||
pageStack.push(Qt.resolvedUrl("WebViewer.qml"),{"webPageAddress": sofficial} )
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user