private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e) { if (e.Label == null) return; ListViewItem item = listView1.Items[e.Item]; SQLiteDatabase db = new SQLiteDatabase(); Dictionary<String, String> data = new Dictionary<String, String>(); data.Add("label", e.Label.ToString()); try { db.Update("history", data, String.Format("history.id = {0}", item.SubItems[3].Text)); // reload loadItems(); } catch (Exception crap) { fallyToast.Toaster alertdb = new fallyToast.Toaster(); alertdb.Show("fallyGrab", crap.Message, -1, "Fade", "Up", "", "", "error"); commonFunctions.writeLog(crap.Message, crap.StackTrace); } }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { // check if there is a selection if (listView1.SelectedItems.Count > 0) { ListViewItem item = listView1.SelectedItems[0]; string x = Interaction.InputBox("Type a label for the screenshot", "Label", item.Text); if (x.Trim() != "") { SQLiteDatabase db = new SQLiteDatabase(); Dictionary<String, String> data = new Dictionary<String, String>(); data.Add("label", x); try { db.Update("history", data, String.Format("history.id = {0}", item.SubItems[3].Text)); // reload loadItems(); } catch (Exception crap) { fallyToast.Toaster alertdb = new fallyToast.Toaster(); alertdb.Show("fallyGrab", crap.Message, -1, "Fade", "Up", "", "", "error"); commonFunctions.writeLog(crap.Message, crap.StackTrace); } } } }
public void ConfigureTVGuide(bool useUPnPStreamUrl = false) { Log("Checking for the source.db and settings.xml files"); if (!System.IO.File.Exists(settings.TVGuidePath)) { Log(" source.db file not found at: " + settings.TVGuidePath); Log("Failed TVGuide configuration"); return; } else { Log(" source.db found at: " + settings.TVGuidePath); } if (!System.IO.File.Exists(settings.TVGuidePath)) { Log(" settings.xml file not found at: " + new FileInfo(settings.TVGuidePath).Directory + @"\settings.xml"); Log("Failed TVGuide configuration"); return; } else { Log(" settings.xml file found at: " + new FileInfo(settings.TVGuidePath).Directory + @"\settings.xml"); } Log("Rewriting TVGuide channels from favorites (including strm file references)"); Log(" Clearing any existing channel configurations"); SQLiteDatabase db = new SQLiteDatabase(settings.TVGuidePath); try { db.ClearTable("CUSTOM_STREAM_URL"); db.ClearTable("CHANNELS"); } catch (Exception crap) { Log(crap.Message); return; } int i = 0; foreach (Channel channel in channels) { if (channel.Checked) { db = new SQLiteDatabase(settings.TVGuidePath); //Channel insert data Dictionary<String, String> channelData = new Dictionary<String, String>(); channelData.Add("ID", channel.Id); channelData.Add("TITLE", channel.VirtualNumber + " " + channel.Callsign); channelData.Add("SOURCE", "xmltv"); channelData.Add("VISIBLE", "1"); channelData.Add("WEIGHT", i.ToString()); //Custom streams insert data Dictionary<String, String> streamData = new Dictionary<String, String>(); streamData.Add("CHANNEL", channel.Id); if (!useUPnPStreamUrl) { streamData.Add("STREAM_URL", StrmDirectory + channel.Filename); } else { string uuid = "missing-uuid-configuration"; try { uuid = settings.HDHRDMS.Split('|')[1]; } catch (Exception){} streamData.Add("STREAM_URL", "upnp://" + uuid + "/CableTV%2fv" + channel.VirtualNumber); } //Sources update Dictionary<String, String> xmltvSourceUpdate = new Dictionary<String, String> { { "CHANNELS_UPDATED", "current_timestamp" } }; db.Update("SOURCES", xmltvSourceUpdate, "ID=\"xmltv\""); try { db.Insert("CHANNELS", channelData); db.Insert("CUSTOM_STREAM_URL", streamData); Log(" Wrote channel: " + channel.VirtualNumber + " - " + channel.Callsign + " With stream path: " + streamData["STREAM_URL"]); } catch (Exception crap) { Log(crap.Message); } i++; } } Log("Updating settings and last updated timestamps"); UpdateTVGuideSettingXML(); //Custom streams insert data DataTable updateMax; String query = "select max(id) + 1 as next_id from UPDATES;"; updateMax = db.GetDataTable(query); string nextId = ""; foreach (DataRow dRow in updateMax.Rows) { nextId = dRow["next_id"].ToString(); } Dictionary<String, String> updatesData = new Dictionary<String, String>(); updatesData.Add("ID", nextId); updatesData.Add("SOURCE", "xmltv"); updatesData.Add("DATE", DateTime.UtcNow.ToString("yyyy-MM-dd")); updatesData.Add("PROGRAMS_UPDATED", "current_timestamp"); db.Insert("UPDATES", updatesData); //Settings update data Dictionary<String, String> sourceSetting = new Dictionary<String, String> { { "VALUE", "XMLTV" } }; db.Update("SETTINGS", sourceSetting, String.Format("KEY = {0}", "\"source\"")); Dictionary<String, String> xmltvFileSetting = new Dictionary<String, String> { { "VALUE", new FileInfo(settings.MC2XMLPath).Directory + @"\xmltv.xml" } }; db.Update("SETTINGS", xmltvFileSetting, String.Format("KEY = {0}", "\"xmltv.file\"")); Log("Done updating TVGuide!"); }