Given the following code:
Item {
id: mainPage
anchors.fill: parent
function getMetaData(metaData) {
var text = ""
text += "title: " + metaData.title + "\n"
text += "subTitle: " + metaData.subTitle + "\n"
text += "author: " + metaData.author + "\n"
text += "comment: " + metaData.comment + "\n"
text += "description: " + metaData.description + "\n"
text += "category: " + metaData.category + "\n"
text += "genre: " + metaData.genre + "\n"
text += "language: " + metaData.language + "\n"
text += "albumTitle: " + metaData.albumTitle + "\n"
text += "albumArtist: " + metaData.albumArtist + "\n"
text += "coverArtUrlSmall: " + metaData.coverArtUrlSmall + "\n"
text += "coverArtUrlLarge: " + metaData.coverArtUrlLarge + "\n"
text += "posterUrl: " + metaData.posterUrl + "\n"
return text
}
MediaPlayer {
id: audioPlayer
audioRole: MusicRole
source: "https://s3-webradio.antenne.de/antenne/stream/mp3?aw_0_1st.playerid=radio.de"
//source: "https://swr-swr3-live.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3"
//source: "http://bob.hoerradar.de/radiobob-hartesaite-mp3-hq?sABC=5r65511s%230%23os634o21s23sr4751opp80560p2o2sr6%23fgernzf.enqvbobo.qr&amsparams=playerid:streams.radiobob.de;skey:1583698207"
onPlaybackStateChanged: {
console.log("State: " + audioPlayer.status + " Meta data: \n" + getMetaData(audioPlayer.metaData));
}
}
}
The audio streams I have tried will playback just fine. However I am unable to retrieve meta data for the streams. E.g. title, artist, and so on. All of the meta fields will just be "undefined".
I have tried several streams, none would show any meta data. Yet I am sure the stream provides those infos, since other player applications will show title, artist, etc.
I have tried other approaches (like here), but still I don't get any metadata.
I am on ubuntu touch, if that matters, and app armor policies are ["audio", "networking"] (also tried music_files_read, didn't help).
Can anyone help me out?
you forget some little things:
1.audioRole: MediaPlayer.MusicRole
2. mainPage.getMetaData(audioPlayer.metaData)); you should call mainPage id and then call its function.
here is correct code :
Item {
id: mainPage
anchors.fill: parent
function getMetaData(metaData) {
var text = ""
text += "title: " + metaData.title + "\n"
text += "subTitle: " + metaData.subTitle + "\n"
text += "author: " + metaData.author + "\n"
text += "comment: " + metaData.comment + "\n"
text += "description: " + metaData.description + "\n"
text += "category: " + metaData.category + "\n"
text += "genre: " + metaData.genre + "\n"
text += "language: " + metaData.language + "\n"
text += "albumTitle: " + metaData.albumTitle + "\n"
text += "albumArtist: " + metaData.albumArtist + "\n"
text += "coverArtUrlSmall: " + metaData.coverArtUrlSmall + "\n"
text += "coverArtUrlLarge: " + metaData.coverArtUrlLarge + "\n"
text += "posterUrl: " + metaData.posterUrl + "\n"
return text
}
MediaPlayer {
id: audioPlayer
audioRole: MediaPlayer.MusicRole
source: "https://s3-webradio.antenne.de/antenne/stream/mp3?aw_0_1st.playerid=radio.de"
//source: "https://swr-swr3-live.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3"
//source: "http://bob.hoerradar.de/radiobob-hartesaite-mp3-hq?sABC=5r65511s%230%23os634o21s23sr4751opp80560p2o2sr6%23fgernzf.enqvbobo.qr&amsparams=playerid:streams.radiobob.de;skey:1583698207"
metaData.onMetaDataChanged: {
console.log("State: " + audioPlayer.status + " Meta data: \n" + mainPage.getMetaData(audioPlayer.metaData));
}
}
}
here is out put :
As you see in this picture it shows genre: Pop
I test another music from this site and print another metadata , undefined means that the source doesn't have this metaData .
Related
I want to give last cell value of col no. 20 when mail has been sent with time and date in the below script. and using this code when more than one rows are added at a time then "sent" value is being added to the last row only and remaining rows are left blank. when new other row is added since value is not equal to sent those values are also been attached So, when mail sent complete column need to be given value as sent. Once please check this
function sendEmail() {
//setup function
var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2");
var StartRow = 2;
var RowRange = ActiveSheet.getLastRow() - StartRow + 1;
var WholeRange = ActiveSheet.getRange(StartRow,1,RowRange,16);
var AllValues = WholeRange.getValues();
var message = "";
//iterate loop
for (i in AllValues) {
//set current row
var CurrentRow = AllValues[i];
//define column to check if sent (starts from "0" not "1")
var EmailSent = CurrentRow[14];
var caseworker = CurrentRow[7];
//if row has been sent, then continue to next iteration
if (EmailSent == "sent")
continue;
//set HTML template for information
message +=
"<p><b>Bank: </b>" + CurrentRow[1] + "</p>" +
"<p><b>Branch: </b>" + CurrentRow[2] + "</p>" +
"<p><b>Region: </b>" + CurrentRow[3] + "</p>" +
"<p><b>Lan Number: </b>" + CurrentRow[4] + "</p>" +
"<p><b>Customer Name: </b>" + CurrentRow[5] + "</p>" +
"<p><b>Loan Type: </b>" + CurrentRow[6] + "</p>" +
"<p><b>Case Worker: </b>" + CurrentRow[7] + "</p>" +
"<p><b>Site Visit Status: </b>" + CurrentRow[8] + "</p>" +
"<p><b>Site Visit Done By: </b>" + CurrentRow[9] + "</p>" +
"<p><b>Document recieved: </b>" + CurrentRow[11] + "</p>" +
"<p><b>File Upload: </b>" + CurrentRow[12] + "</p>" +
"<p><b>Remarks: </b>" + CurrentRow[10] + "</p><br><br>";
//set the row to look at
var setRow = parseInt(i) + StartRow;
//mark row as "sent"
ActiveSheet.getRange(setRow, 15).setValue("sent");
}
//define who to send grants to
var SendTo = "########gmail.com" + "," + "##########gmail.com" + "," + " ##########gmail.com";
//set subject line
var Subject = "New case initiated to Shirisha";
//send the actual email
MailApp.sendEmail({
to: SendTo,
cc: "##########gmail.com",
subject: Subject,
htmlBody: message,
});
}
I have set the html from code behind in ItemDataBound event of repeater but in html path is not right.
Dim video_path = imgUrl + VideoPath + VideoName.split(".")(0) + ".mp4"
Dim poster_path = imgUrl + VideoPath + VideoName.split(".")(0) + ".png"
Dim DvVidContent As HtmlContainerControl = CType(e.Item.FindControl("DvVidContent"), HtmlContainerControl)
Dim onclick = "'ShowVideoDialog('size_vp_" + count.ToString() + "', '" + video_path.ToString().Trim() + "');'"
Dim Header As String = "<div style='position:relative;' Sequence='" + count.ToString() + "' id='" + ID.ToString() + "' class='SessionFolderViewChild'><img onerror='handleError(this);' src='" + poster_path.ToString() + "' alt='Thumbnail'/><img class='dv_play_icon' onclick='" + onclick + "' id='PlayVideo' style='position:absolute;top:8px;left:26px;height:100px;width:100px;' src='../../Images/icn_Play.png'/></a></div>"
DvVidContent.InnerHtml = Header.Trim()
count = count +
After Html rendering its remove the forward slash and look like
onclick="ShowVideoDialog("size_vp_1','.. .. resources sbs attachments steps351 step565 130906720751358852.mp4');
I want to update the col_Item_Auto_ID column with +1 in each column
Like this: replace 10 with 11, 11 with 12, etc!!
Help me pls... here the code is,
public void updateMiddleTemp(int autoid) {
SQLiteDatabase db = this.getWritableDatabase();
int id=51;
ContentValues cv_temp1 = new ContentValues();
cv_temp1.put(col_Item_Auto_ID, col_Item_Auto_ID+1);
//ff
long stemp = db.updateWithOnConflict(Table_KOT_ITEMS_TEMP, cv_temp1,
col_Item_Auto_ID + " >= " + autoid, null,SQLiteDatabase.CONFLICT_IGNORE);
db.close();
}
Try this code, it works fine:
db.execSQL("UPDATE " + Table_KOT_ITEMS_TEMP + " SET "
+ col_Sl_No + " = " + col_Sl_No + " +1 WHERE "
+ col_Sl_No + " >" +into);
db.close();
You cannot do this with standard update method - you need to use execSql method instead:
String sql = "UPDATE " + Table_KOT_ITEMS_TEMP +
" SET " + col_Item_Auto_ID + "=" + col_ITEM_AUTO_ID + "+1" +
" WHERE " + col_ItemAutoID + " >= " + autoid;
db.execSql(sql);
This can be done with updateWithOnConflict().
The value provided for the value field in ContentValues is incorrect.
Resulting value should be "col_Item_Auto_ID + 1" and not "col_Item_Auto_ID1".
So try changing
cv_temp1.put(col_Item_Auto_ID, col_Item_Auto_ID+1);
to
cv_temp1.put(col_Item_Auto_ID, col_Item_Auto_ID+"+1");
This code worked for me:
String query = "UPDATE " + Constants.RecentChats.DB_RECENT_CHATS + " SET "
+ Constants.RecentChats.UNREAD_COUNT + " = "
+ Constants.RecentChats.UNREAD_COUNT +"+1"+ " WHERE "
+ Constants.RecentChats.JID + " =" + id;
db.execSQL(query);
Following is my code.I have used class in my website.But i am getting error as "Incorrect syntax near ',' ".....can anyone tell me what is wrong in the code..
protected void btnadd_Click(object sender, EventArgs e)
{
s1 = "Update tckt_tbl Set class='" + ddlclass.Text + "',dist=" + lbldist.Text + ",no_of_adults=" + ddladults.Text + ",no_of_senior=" + ddlsenior.Text + ",n1='" + txtn1.Text + "',";
s1 += "n2='" + txtn2.Text + "',n3='" + txtn3.Text + "',n4='" + txtn4.Text + "',n5='" + txtn5.Text + "',n6='" + txtn6.Text + "',";
s1 += "ag1=" + txtag1.Text + ",ag2=" + txtag2.Text + ",ag3=" + txtag3.Text + ",ag4=" + txtag4.Text + ",ag5=" + txtag5.Text + ",ag6=" + txtag6.Text + ",";
s1 += "gen1='" + txtgen1.Text + "',gen2='" + txtgen2.Text + "',gen3='" + txtgen3.Text + "',gen4='" + txtgen4.Text + "',gen5='" + txtgen5.Text + "',gen6='" + txtgen6.Text + "',";
s1 += "cn1='" + txtchn1.Text + "',cn2='" + txtchn2.Text + "',cag1=" + txtcag1.Text + ",cag2=" + txtcag2.Text + ",cgen1='" + txtcgen1.Text + "',cgen2='" + txtcgen2.Text + "' Where userid=" + Session["suser"].ToString() + "";
con.ExecQuery(s1);
Response.Redirect("tcktbook_itckt.aspx");
}
First off, it is a really bad idea to build a query from user input. I suggest you use a parameterized query instead.
Try outputting s1 to see what the query looks like.
Chances are good that you have an unbalanced quote.
On third line there is problem.
s1 += "ag1=" + txtag1.Text + ",ag2=" + txtag2.Text + ",ag3=" + txtag3.Text + ",ag4=" + txtag4.Text + ",ag5=" + txtag5.Text + ",ag6=" + txtag6.Text + ",";
I think here commas and semicoluns are not given properly.
I suggest you use Parameter Query, rather than concatenate everything. But before that, are you sure that you already give all value? Because if you didn't give any value for numeric field, it should show an error, since the query become:
..cag1=,cag2..
i will use lucene.net first time so couple of confusion arising in mind when see the line of code. i got a sample code for searching word with lucene and few line are not clear to me.here is sample code below.
Question 1
ListBox1.Items.Clear();
var searcher = new Lucene.Net.Search.IndexSearcher(MapPath("~/searchlucene/"));
var oParser = new Lucene.Net.QueryParsers.QueryParser("content", new StandardAnalyzer());
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
var oHitColl = searcher.Search(oParser.Parse(sSearchQuery));
for (int i = 0; i < oHitColl.Length(); i++)
{
Document oDoc = oHitColl.Doc(i);
ListBox1.Items.Add(new ListItem(oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")));
}
searcher.Close();
Question 2
this below lines not clear what is going on...!! please discuss the objective of each line below.
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
var oHitColl = searcher.Search(oParser.Parse(sSearchQuery));
for (int i = 0; i < oHitColl.Length(); i++)
{
Document oDoc = oHitColl.Doc(i);
ListBox1.Items.Add(new ListItem(oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")));
}
Question 3
what is header:
what is type:
why heade & type concatinated after search keyword like string
sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
Question 4
why content is missing in searchquery content
what would be the result if i write like
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sContent = " OR (content:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + sContent ")";
why header, type & content is reading....what for??
*oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")*
why i need to read header,type & content like
oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")
we can read content only....why type & header is also required??
The first code builds a query that searches several fields, assuming that the input in TextBox1 does not mess with the query (like containing parentheses or whitespaces). Building a search query with string concatenation is often hard to get right, I would use the MultiFieldQueryParser instead.
var fields = new[] { "content", "header", "type" };
var analyzer = new StandardAnalyzer(Version.LUCENE_30);
var queryParser = new MultiFieldQueryParser(Version.LUCENE_30, fields, analyzer);
var query = queryParser.Parse(TextBox1.Text);
var result = searcher.Search(query, 25); /* find 25 best matches */
Your for-loop iterates through the result and reads the values of the stored fields and add them to a listbox. This requires that the fields where indexed with Field.Store.YES to work.