Cleainging up, bug hunting and optimizing

This commit is contained in:
Niels 2025-06-07 17:19:19 +02:00
parent c96a4c3387
commit 54b997ad61
16 changed files with 329 additions and 440 deletions

View File

@ -1,16 +1,10 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
//import Nemo.Configuration 1.0 ///////// import Nemo.Notifications 1.0
import Nemo.Notifications 1.0 ///////////
import Amber.Mpris 1.0 import Amber.Mpris 1.0
import "pages" import "pages"
import "items" import "items"
//import "radio-player"
//import "video-player"
import "helpers" import "helpers"
//import "jupii"
// Check out Amber Mpris Qml !!!
ApplicationWindow ApplicationWindow
{ {
@ -18,52 +12,50 @@ ApplicationWindow
property string _version: "2.0.16" property string _version: "2.0.16"
property string _language: Qt.locale().name.slice(0,2) property string _language: Qt.locale().name.slice(0,2)
property string _country: Qt.locale().name.slice(-2) property string _country: Qt.locale().name.slice(-2)
//property int currentListIndex: -1
//property int currentListCount: -1
property int sleepTime: 0 property int sleepTime: 0
//property alias settings: allradioSettings
property alias mediaPlayerPanel: mediaPlayerPanel property alias mediaPlayerPanel: mediaPlayerPanel
property alias radioPlayer: radioPlayer
property alias radioBrowser: radioBrowser
property alias sleepTimer: sleepTimer
/*
property RadioPlayer radioPlayer : RadioPlayer {id:radioPlayer} property RadioPlayer radioPlayer : RadioPlayer {id:radioPlayer}
property RadioBrowser radioBrowser : RadioBrowser {id:radioBrowser;parent: allRadio} property RadioBrowser radioBrowser : RadioBrowser {id:radioBrowser;parent: allRadio}
property SleepTimer sleepTimer : SleepTimer {id:sleepTimer} property SleepTimer sleepTimer : SleepTimer {id:sleepTimer}
*/
SleepTimer {id: sleepTimer}
RadioBrowser {id: radioBrowser; parent: allRadio}
RadioPlayer {id: radioPlayer}
RadioMprisPlayer {id: radioMprisPlayer} RadioMprisPlayer {id: radioMprisPlayer}
MediaPlayerPanel {id: mediaPlayerPanel} MediaPlayerPanel {id: mediaPlayerPanel}
//ConfigurationGroup {id:settingsGroup;path: "/apps/harbour-allradio";ConfigurationGroup {id: allradioSettings;path: "/settings"}}
Notification {id: notification;onClicked: console.log("Clicked")} Notification {id: notification;onClicked: console.log("Clicked")}
//MprisPlayer {}
// Not finished. --latest and --random should work though
function handleArguments() { function handleArguments() {
for(var i = 1; i < Qt.application.arguments.length; i++) { for(var i = 1; i < Qt.application.arguments.length; i++) {
switch (Qt.application.arguments[i]) { switch (Qt.application.arguments[i]) {
case "--help": help();break; // no argument case "--help": help();break; // no argument
//case "--codec": console.info("*** CODEC *** "+Qt.application.arguments[i+1]);break; // argument can be: mp3, aac, aac+, hls
//case "--favorite": console.info("*** FAVORITE *** "+Qt.application.arguments[i+1]);break; // argument can be: top, latest, random
//case "--pause": console.info("*** HISTORY *** "+Qt.application.arguments[i+1]);break; // argument can be: top, latest, random
case "--sleep": console.info("*** SLEEP *** : "+Qt.application.arguments[i+1]);break; // play for 1-120 minutes (sleeptimer) case "--sleep": console.info("*** SLEEP *** : "+Qt.application.arguments[i+1]);break; // play for 1-120 minutes (sleeptimer)
case "--latest": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);latest();break; // latest, saved, random, world case "--latest": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);latest();break; // latest, saved, random, world
case "--random": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);random();break; // latest, saved, random, world case "--random": console.info("*** PLAY *** : "+Qt.application.arguments[i+1]);random();break; // latest, saved, random, world
} }
} }
} }
// Help text to be displayed in the console
function help(){ function help(){
console.info("help") console.info("help")
} }
// Play latest from console 'harbour-allradio --latest'
function latest(){ function latest(){
radioPlayer.loadRecentPlay() radioPlayer.loadRecentPlay()
radioPlayer.playStream() radioPlayer.playStream()
} }
// Play random from console (stations added to favorites needed) 'harbour-allradio --random'
function random(){ function random(){
radioPlayer.loadRandomPlay() radioPlayer.loadRandomPlay()
radioPlayer.playStream() radioPlayer.playStream()
} }
initialPage: Component { AllRadio { } }
initialPage: Component { AllRadio { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml") cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations allowedOrientations: defaultAllowedOrientations
Component.onCompleted: {mediaPlayerPanel.parent.z = 99;handleArguments()} Component.onCompleted: {mediaPlayerPanel.parent.z = 99;handleArguments()}

View File

@ -24,7 +24,7 @@ function checkforold() {
function init() { function init() {
db = settings_db_open(); db = settings_db_open();
checkforold() //checkforold()
try { try {
db.transaction( db.transaction(
function(tx) { function(tx) {
@ -227,10 +227,7 @@ function getStationFavorite(id) { // Get info about number of clicks and if stat
db.transaction(function(tx) { db.transaction(function(tx) {
var rs = tx.executeSql('SELECT * FROM stations WHERE id = "'+id+'" AND favorite = 1'); var rs = tx.executeSql('SELECT * FROM stations WHERE id = "'+id+'" AND favorite = 1');
res = rs.rows.length res = rs.rows.length
// console.log("FAVO RESULT: "+res+" ID: "+id )
if (res>0) return true; else return false; if (res>0) return true; else return false;
}) })
} catch (err) { } catch (err) {
res = 0 res = 0

View File

@ -34,129 +34,109 @@ Item {
//property int viewTagCount: tagsModel.maxCount //property int viewTagCount: tagsModel.maxCount
property int countryCount: 0 property int countryCount: 0
property bool loading: stationCount !== 0 && tagCount !== 0 && countryCount !== 0 ? false : true property bool loading: stationCount !== 0 && tagCount !== 0 && countryCount !== 0 ? false : true
property string lookup: "http://all.api.radio-browser.info/json/servers" //"http://all.api.radio-browser.info/json/servers" property string lookup: "http://all.api.radio-browser.info/json/servers"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
onOnlineChanged: { onOnlineChanged: {
//console.log("onOnlineChanged")
if (online && serverUrl !== "") { if (online && serverUrl !== "") {
countriesModel.source = serverUrl + "/xml/countrycodes?hidebroken=true" countriesModel.source = serverUrl + "/xml/countrycodes?hidebroken=true"
//tagsModel.source = serverUrl + "/xml/tags?hidebroken=true"
} }
} }
function getServer(s,u) { // Not used?!?!?
//console.log("getServer") /* function getServer(s,u) {
stationCount = 0 stationCount = 0
tagCount = 0 tagCount = 0
countryCount = 0 countryCount = 0
server = s server = s
serverUrl = u serverUrl = u
getStats() getStats()
} } */
// Choose a random server from available servers
function getRandom() { function getRandom() {
//console.log("getRandom")
if (serversModel.count > 0) { if (serversModel.count > 0) {
var random = Math.floor((Math.random() * serversModel.count) + 1) - 1 var random = Math.floor((Math.random() * serversModel.count) + 1) - 1
serverUrl = serversModel.get(random).serverUrl serverUrl = serversModel.get(random).serverUrl
server = serversModel.get(random).server server = serversModel.get(random).server
//console.log("getRandom: "+server)
getStats() getStats()
}
} //else getList()
} }
// Get a list of available Radio Community Servers.
function getList() { function getList() {
//console.log("getList")
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.open("get", lookup,true);
req.setRequestHeader('User-Agent',_useragent);
req.timeout = 4000; // Set timeout to 4 seconds (4000 milliseconds)
req.ontimeout = function () { console.log("Timed out!!!"); }
//console.log("server 2")
req.onreadystatechange = function () { req.onreadystatechange = function () {
//console.log(console.log("getList: "+req.status)) if (req.readyState === 4 && req.status < 300) {
if (req.readyState === 4 && req.status === 200) {
var obj = JSON.parse(req.responseText) var obj = JSON.parse(req.responseText)
serversModel.clear() serversModel.clear()
for (var key in obj) { for (var key in obj) {
addIfNotExist(obj[key]) addIfNotExist(obj[key])
} }
getRandom() getRandom()
} else if (req.readyState === 4 && req.status === 502) {lookup="http://de2.api.radio-browser.info/json/servers";getList();} } else if (req.readyState === 4 && req.status > 299) {lookup="http://de2.api.radio-browser.info/json/servers";getList();}
}; };
req.open("get", lookup);
req.setRequestHeader('User-Agent',_useragent);
req.send(); req.send();
} }
// Add available server to listmodel
function addIfNotExist(server) { function addIfNotExist(server) {
for (var i = 0; i < serversModel.count; i++) { for (var i = 0; i < serversModel.count; i++) {
if (serversModel.get(i).server === server.name) { if (serversModel.get(i).server === server.name) {
return return
} }
} }
serversModel.append({"serverUrl": "http://"+server.name,"server": server.name}) serversModel.append({"serverUrl": "http://"+server.name,"server": server.name})
} }
// ----------------------------------------------
// Station online?
function getStats() { function getStats() {
//console.log("getStats")
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.open("get", serverUrl+"/json/stats",true);
req.setRequestHeader('User-Agent',_useragent);
req.onreadystatechange = function () { req.onreadystatechange = function () {
//console.log("XMLHTTPREQUEST READYSTATE: "+req.readyState + " STATUS: "+req.status) if (req.readyState === 4 && req.status < 300) {
if (req.readyState === 4 && req.status === 200) {
//console.log("STATUS:"+req.status)
var obj = req.response.split("{").pop(); var obj = req.response.split("{").pop();
obj = JSON.parse("{"+obj) obj = JSON.parse("{"+obj)
if (obj.status === "OK") { if (obj.status === "OK") {
stationCount = obj.stations-obj.stations_broken stationCount = obj.stations-obj.stations_broken
tagCount = obj.tags tagCount = obj.tags
if (obj.status === "OK") {online = true} else {online = false} if (obj.status === "OK") {online = true} else {online = false}
} }
} else if (req.readyState === 4 && req.status === 502) getRandom() } else if (req.readyState === 4 && req.status > 299) getRandom()
}; };
req.open("get", serverUrl+"/json/stats");
req.setRequestHeader('User-Agent',_useragent);
req.send(); req.send();
} }
// ----------------------------------------------
// Vote/like for radio station on community radio browser.
function upVote(stationuuid,returnValue) { function upVote(stationuuid,returnValue) {
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
var ret = false var ret = false
req.open("get", serverUrl+"/json/vote/"+stationuuid,true);
req.setRequestHeader('User-Agent',_useragent);
req.onreadystatechange = function () { req.onreadystatechange = function () {
//console.log("XMLHTTPREQUEST READYSTATE: "+req.readyState + " STATUS: "+req.status)
if (req.readyState === 4 && req.status === 200) { if (req.readyState === 4 && req.status === 200) {
var obj = req.response.split("{").pop(); var obj = req.response.split("{").pop();
obj = JSON.parse("{"+obj) obj = JSON.parse("{"+obj)
//console.log(obj.ok)
if (obj.ok) { if (obj.ok) {
//stationCount = obj.stations-obj.stations_broken
//tagCount = obj.tags
if (obj.ok) {returnValue=true;console.log(" ****** VOTED *****")} else {returnValue=false;console.log(" ****** NOT VOTED *****")} if (obj.ok) {returnValue=true;console.log(" ****** VOTED *****")} else {returnValue=false;console.log(" ****** NOT VOTED *****")}
} }
return ret return ret
} }
}; };
req.open("get", serverUrl+"/json/vote/"+stationuuid);
req.setRequestHeader('User-Agent',_useragent);
req.send(); req.send();
} }
// ----------------------------------------------
// Load model with country names.
CountryNameModel {id: countryNameModel} CountryNameModel {id: countryNameModel}
function getCountryName(land) { // Get translated countryname function getCountryName(land) { // Get translated countryname
for(var i = 0; i < countryNameModel.count; i++) { for(var i = 0; i < countryNameModel.count; i++) {
var current = countryNameModel.get(i); var current = countryNameModel.get(i);
if(land === current.code) { if(land === current.code) {
return countryNameModel.countryname(i) return countryNameModel.countryname(i)
} }
} }
} }
} }

View File

@ -14,29 +14,12 @@ MprisPlayer {
supportedMimeTypes: ["audio/x-wav", "audio/x-vorbis+ogg", "audio/mpeg", "audio/mp4a-latm", "audio/x-aiff"] supportedMimeTypes: ["audio/x-wav", "audio/x-vorbis+ogg", "audio/mpeg", "audio/mp4a-latm", "audio/x-aiff"]
canControl: true canControl: true
/*
function playNext() {
if (playlistIndex < playlistCount && playlistIndex < playlist.count) playlistIndex = playlistIndex + 1
loadPlaylistSelected()
}
function playPrev() {
if (playlistIndex <= playlistCount && playlistIndex > 0) playlistIndex = playlistIndex - 1 //: playlistIndex = 0
loadPlaylistSelected()
}
*/
canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 && radioPlayer._favorite canGoNext: radioPlayer.playlistIndex < radioPlayer.playlist.count -1 && radioPlayer._favorite
//true //appstate.playlistIndex < appstate.playlist.count canGoPrevious: radioPlayer.playlistIndex > 0 && radioPlayer._favorite
canGoPrevious: radioPlayer.playlistIndex > 0 && radioPlayer._favorite// appstate.playlistIndex > 0
canPause: radioPlayer.isPlaying ? true : false canPause: radioPlayer.isPlaying ? true : false
canPlay: radioPlayer.isPaused ? true : false canPlay: radioPlayer.isPaused ? true : false
canSeek: false
canSeek: false// playback.seekable
hasTrackList: false hasTrackList: false
loopStatus: Mpris.LoopNone loopStatus: Mpris.LoopNone
shuffle: false shuffle: false
volume: 1 volume: 1

View File

@ -19,14 +19,11 @@ MediaPlayer {
property string _url_resolved: "" property string _url_resolved: ""
property string _homepage: "" property string _homepage: ""
// property string _votes: "" // property string _votes: ""
// property string _plays: "" // property string _plays: "" // For future implementation?!
// property string _trend: "" // property string _trend: ""
property bool _favorite: false property bool _favorite: false
//-------------------------------- //--------------------------------
// property bool videoP: false
property bool playerPageOpen: false property bool playerPageOpen: false
// property bool jupiiOn: false
property string radioId: "" property string radioId: ""
property string metaInfo: metaData.title ? metaData.title : "" property string metaInfo: metaData.title ? metaData.title : ""
property string radioArtist: "" property string radioArtist: ""
@ -42,37 +39,23 @@ MediaPlayer {
property string radioStatusString property string radioStatusString
property bool isPlaying: false property bool isPlaying: false
property bool isPaused: false property bool isPaused: false
property int stationOk: 3 property int stationOk: 0
property int maxTagClicks: 0 property int maxTagClicks: 0
property int playlistCount: playlist.count -1 property int playlistCount: playlist.count -1
property int playlistIndex: Favorites.getSetting("playlistIndex",-1) property int playlistIndex: Favorites.getSetting("playlistIndex",-1)
//property int playlistIndex: playlistCount = Favorites.getSetting("playlistIndex",-1) property ListModel playHistory: ListModel {id: playHistory}
property ListModel playlist: ListModel {id: playlist}
property QDtimer timer: QDtimer { property QDtimer timer: QDtimer {
id: qdTimer id: qdTimer
interval: 200; running: false; repeat: false interval: 200; running: false; repeat: false
} }
//property string videoOut: ""
// property ListModel mostPlayedFavorites: ListModel {id: mostPlayedFavorites}
//videoOutput: videoOut
// property variant magnitudeArray: null
// property int millisecondsPerBar: 68
property ListModel playHistory: ListModel {id: playHistory}
property ListModel playlist: ListModel {id: playlist}
autoPlay: false autoPlay: false
autoLoad: true autoLoad: true
//onPlaylistIndexChanged: console.log("INDEX: "+playlistIndex)
//on_FavoriteChanged: {setStationFavorite(_stationuuid,_name,_countrycode,_homepage,_url_resolved,_favicon,_tags,_codec,_bitrate,_hls,_favorite);Favorites.getMostPlayedFavorites(mostPlayedFavorites,15)}
onPlaying: if (!playerPageOpen) pageStack.push("../pages/RadioPlayerPage.qml") onPlaying: if (!playerPageOpen) pageStack.push("../pages/RadioPlayerPage.qml")
// onPlaylistIndexChanged: loadPlaylistSelected()
onMetaInfoChanged: { onMetaInfoChanged: {
// console.log(" ******* METAINFO: "+metaInfo)
if (metaInfo.search(" - ") > -1) { if (metaInfo.search(" - ") > -1) {
var res = metaInfo.split(" - ") var res = metaInfo.split(" - ")
radioArtist = res[0] radioArtist = res[0]
@ -83,12 +66,7 @@ MediaPlayer {
} }
} }
onRadioAudioChanged: {
// if (hasVideo) console.log(" *** VIDEO"); else console.log(" *** AUDIO")
}
onStationOkChanged: { onStationOkChanged: {
// console.log("StationOK?: "+stationOk)
if (stationOk === 1) { if (stationOk === 1) {
setStationClick() setStationClick()
getStationFavorite(_stationuuid) getStationFavorite(_stationuuid)
@ -99,34 +77,102 @@ MediaPlayer {
} }
} }
on_StationuuidChanged: { //if (_stationuuid !== "") {getStationUrl(_stationuuid);radioPlayUrl = _url_resolved} else radioPlayUrl = "" on_StationuuidChanged: {
radioCountryName = radioBrowser.getCountryName(_countrycode) radioCountryName = radioBrowser.getCountryName(_countrycode)
stop() stop()
source = "" source = ""
//metaInfo = ""
radioVideo = false radioVideo = false
radioAudio = false radioAudio = false
isPaused = false isPaused = false
isPlaying = false isPlaying = false
stationOk = 3 stationOk = 0
getStationUrl(_stationuuid); getStationUrl(_stationuuid);
} }
//onIsPausedChanged: if (_paused) {
//radioPlaying = false
///radioPaused = true
// radioSource = ""
// metaInfo = ""
// if(radioVideo) {
// videoPlayer.visible = false
// radioSource = ""
// }
// }
onHasVideoChanged: if (hasVideo) radioVideo = true onHasVideoChanged: if (hasVideo) radioVideo = true
onHasAudioChanged: if (hasAudio) radioAudio = true onHasAudioChanged: if (hasAudio) radioAudio = true
onError: {
notification.category = "Error"
notification.summary = _name
notification.body = errorString
notification.publish()
radioPlayer.stopStream()
}
onStatusChanged: {
switch (status) {
case 1: status1();break; // NoMedia
case 2: status2();break; // Loading
case 3: status3();break; // Loaded
case 4: status4();break; // Buffering
case 5: status5();break; // Stalled
case 6: status6();break; // Buffered
case 7: status7();break; // EndOfMedia
case 8: status8();break; // InvalidMedia
case 9: status9();break; // UnknownStatus
}
}
function status1 () { // NoMedia
radioStatus = status
radioStatusString = "No Media"
}
function status2 () { // Loading
radioStatus = status
radioStatusString = "Loading"
}
function status3 () { // Loaded
radioStatus = status
radioStatusString = "Loaded"
}
function status4 () { // Buffering
radioStatus = status
radioStatusString = "Buffering"
}
function status5 () { // Stalled
radioStatus = status
radioStatusString = "Stalled"
notification.category = "Status"
notification.summary = _name
notification.body = "Stalled"
notification.publish()
radioPlayer.stopStream()
}
function status6 () { // Buffered
radioStatus = status
radioStatusString = "Buffered"
}
function status7 () { // EndOfMedia
radioStatus = status
radioStatusString = "End Of Media"
notification.category = "Status"
notification.summary = _name
notification.body = "End of media"
notification.publish()
radioPlayer.resumeStream()
}
function status8 () { // InvalidMedia
radioStatus = status
radioStatusString = "Invalid Media"
notification.category = "Status"
notification.summary = _name
notification.body = "Invalid media"
notification.publish()
radioPlayer.stopStream()
}
function status9 () { // UnknownStatus
radioStatus = status
radioStatusString = "Unknown Status"
}
function stopStream() { // stop and clear stream function stopStream() { // stop and clear stream
source = "" source = ""
@ -147,50 +193,36 @@ MediaPlayer {
_hls = "" _hls = ""
_homepage = "" _homepage = ""
stop() stop()
// metaInfo = ""
} }
function playNext() { function playNext() {
if (playlistIndex < playlistCount) playlistIndex = playlistIndex + 1 if (playlistIndex < playlistCount) playlistIndex = playlistIndex + 1
loadPlaylistSelected() loadPlaylistSelected()
} }
function playPrev() { function playPrev() {
if (playlistIndex <= playlistCount) playlistIndex = playlistIndex - 1 //: playlistIndex = 0 if (playlistIndex <= playlistCount) playlistIndex = playlistIndex - 1
loadPlaylistSelected() loadPlaylistSelected()
} }
function videoPause() { function videoPause() {
source = "" source = ""
stop() stop()
} }
function pauseStream() {
function pauseStream() { // stop stream without clear
isPaused = true
isPlaying = false isPlaying = false
source = "" source = ""
stop() stop()
// metaInfo = ""
} }
function resumeStream() { function resumeStream() {
isPlaying = true isPlaying = true
isPaused = false isPaused = false
playStream() playStream()
} }
function playStream() {
function playStream() { // resume paused stream
source = _url_resolved source = _url_resolved
play() play()
isPlaying = true isPlaying = true
@ -199,142 +231,20 @@ MediaPlayer {
if (_favorite) Favorites.setSetting("playlistIndex",playlistIndex) if (_favorite) Favorites.setSetting("playlistIndex",playlistIndex)
} }
onError: {
notification.category = "Error"
notification.summary = _name
//notification.subText = _name
notification.body = errorString
notification.publish()
radioPlayer.stopStream()
}
/* onRadioStatusChanged: {
notification.body = radioStatusString
notification.publish()
}*/
onStatusChanged: {
//console.log(" ___ STATUS: "+status)
switch (status) {
case 1: status1();break; // NoMedia
case 2: status2();break; // Loading
case 3: status3();break; // Loaded
case 4: status4();break; // Buffering
case 5: status5();break; // Stalled
case 6: status6();break; // Buffered
case 7: status7();break; // EndOfMedia
case 8: status8();break; // InvalidMedia
case 9: status9();break; // UnknownStatus
}
}
function tryagain() { function tryagain() {
tryTimer.running = true tryTimer.running = true
} }
function status1 () { // NoMedia
radioStatus = status
radioStatusString = "No Media"
//console.log("Status: No Media")
}
function status2 () { // Loading
radioStatus = status
radioStatusString = "Loading"
//console.log("Status: Loading")
}
function status3 () { // Loaded
radioStatus = status
radioStatusString = "Loaded"
//console.log("Status: Loaded")
}
function status4 () { // Buffering
radioStatus = status
radioStatusString = "Buffering"
//console.log("Status: Buffering")
}
function status5 () { // Stalled
radioStatus = status
radioStatusString = "Stalled"
notification.category = "Status"
notification.summary = _name
//notification.subText = _name
notification.body = "Stalled"
notification.publish()
//console.log("Status: Stalled")
radioPlayer.stopStream()
}
function status6 () { // Buffered
radioStatus = status
radioStatusString = "Buffered"
//console.log("Status: Buffered")
}
function status7 () { // EndOfMedia
/* if (errorCount<4) {
//errorCount = errorCount + 1
tryTimer.start()
}else{ */
radioStatus = status
radioStatusString = "End Of Media"
notification.category = "Status"
notification.summary = _name
//notification.subText = _name
notification.body = "End of media"
notification.publish()
//console.log("Status: End Of Media")
radioPlayer.resumeStream()
// }
}
function status8 () { // InvalidMedia
radioStatus = status
radioStatusString = "Invalid Media"
notification.category = "Status"
notification.summary = _name
//notification.subText = _name
notification.body = "Invalid media"
notification.publish()
//console.log("Status: Invalid Media")
radioPlayer.stopStream()
}
function status9 () { // UnknownStatus
radioStatus = status
radioStatusString = "Unknown Status"
//console.log("Status: Unknown Status")
}
function getStationUrl(id) { // Register as radio station click on community radio and get station info from Community Radio and save it to Db. Initiate playback.
var req = new XMLHttpRequest();
req.open("post", radioBrowser.serverUrl + "/xml/url/" +id, true);
// console.log(radioBrowser.serverUrl)
req.responseType = "document";
req.setRequestHeader('User-Agent',radioBrowser._useragent);
req.onreadystatechange = function () {
if (req.readyState === 4 && req.status === 200) {
var temp = req.responseText
var ok = temp.indexOf('status ok="true"') !== -1
// console.log("OK: "+ok)
if (ok) {
stationOk = 1
} else {
stationOk = 0
}
} //else if (req.readyState === 4) {stationOk = 2}
};
req.send();
}
function setStationClick() { function setStationClick() {
//getStationFavorite(_stationuuid)
Favorites.setStationClicked(JsFunctions.getTimeStamp(),_stationuuid,_name,_countrycode,_homepage,_url_resolved,_favicon,_tags,_codec,_bitrate,_hls,_favorite) Favorites.setStationClicked(JsFunctions.getTimeStamp(),_stationuuid,_name,_countrycode,_homepage,_url_resolved,_favicon,_tags,_codec,_bitrate,_hls,_favorite)
}
// property bool favo: isFavorite(stationuuid) ? true : false
//getIfFavorite(_stationuuid)
//getIfFavorite(_stationuuid)
} // myclicktimestamp,id,name,countrycode,homepage,radiourlresolved,favicon,tagslist,codec,bitrate,hls,favorite
function setStationFavorite(stationuuid,name,countrycode,homepage,url_resolved,favicon,tags,codec,bitrate,hls,favorite) { function setStationFavorite(stationuuid,name,countrycode,homepage,url_resolved,favicon,tags,codec,bitrate,hls,favorite) {
Favorites.setStationFavorite(stationuuid,name,countrycode,homepage,url_resolved,favicon,tags,codec,bitrate,hls,favorite) Favorites.setStationFavorite(stationuuid,name,countrycode,homepage,url_resolved,favicon,tags,codec,bitrate,hls,favorite)
} }
function getStationFavorite(id){ function getStationFavorite(id){
_favorite = Favorites.getStationFavorite(id) _favorite = Favorites.getStationFavorite(id)
} }
@ -342,12 +252,12 @@ MediaPlayer {
function reloadDbData() { function reloadDbData() {
Favorites.getStationRecentClicked(playHistory,15) Favorites.getStationRecentClicked(playHistory,15)
Favorites.getFavorites(playlist,"myclickcount",10000) Favorites.getFavorites(playlist,"myclickcount",10000)
//Favorites.getStationMostClickedFav(radioPlayermostPlayed,settings._nrOfFavoritePreview) //Favorites.getStationMostClickedFav(radioPlayermostPlayed,settings._nrOfFavoritePreview)
//Favorites.getCountryRecentClicked(playedCountries,2) //Favorites.getCountryRecentClicked(playedCountries,2)
//Favorites.getTagsRecentClicked(playedTags,10) //Favorites.getTagsRecentClicked(playedTags,10)
//Favorites.getMostPlayedFavorites(mostPlayedFavorites,15) //Favorites.getMostPlayedFavorites(mostPlayedFavorites,15)
} }
function loadPlaylistSelected(){ function loadPlaylistSelected(){
if (playlist.get(playlistIndex).url_resolved) { if (playlist.get(playlistIndex).url_resolved) {
_favicon = playlist.get(playlistIndex).favicon _favicon = playlist.get(playlistIndex).favicon
@ -368,6 +278,7 @@ MediaPlayer {
// pageStack.push("RadioPlayerPage.qml") // pageStack.push("RadioPlayerPage.qml")
} }
} }
function loadRecentPlay(){ function loadRecentPlay(){
if (playHistory.get(0).url_resolved) { if (playHistory.get(0).url_resolved) {
_favicon = playHistory.get(0).favicon _favicon = playHistory.get(0).favicon
@ -388,6 +299,7 @@ MediaPlayer {
// pageStack.push("RadioPlayerPage.qml") // pageStack.push("RadioPlayerPage.qml")
} }
} }
function loadRandomPlay(){ function loadRandomPlay(){
var rnd = Math.floor(Math.random() * playlist.count) var rnd = Math.floor(Math.random() * playlist.count)
if (playlist.get(rnd).url_resolved) { if (playlist.get(rnd).url_resolved) {
@ -431,9 +343,24 @@ MediaPlayer {
mprisPlayer.playbackStatus = Mpris.Paused mprisPlayer.playbackStatus = Mpris.Paused
} }
} }
// Register as radio station click on community radio and get station info from Community Radio and save it to Db. Initiate playback.
function getStationUrl(id) {
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState === 4 && req.status < 300) {
var temp = req.responseText
var ok = temp.indexOf('status ok="true"') !== -1
if (ok) {
stationOk = 1
} else {
stationOk = 0
}
}
};
req.open("post", radioBrowser.serverUrl + "/xml/url/" +id);
req.setRequestHeader('User-Agent',radioBrowser._useragent);
req.send();
}
Component.onCompleted: {reloadDbData();_favorite ? loadPlaylistSelected() : loadRecentPlay()} Component.onCompleted: {reloadDbData();_favorite ? loadPlaylistSelected() : loadRecentPlay()}
} }

View File

@ -6,10 +6,6 @@ XmlListModel {
property bool clear: false property bool clear: false
property ListModel stationsModel: ListModel {id: stationsModel} property ListModel stationsModel: ListModel {id: stationsModel}
// onFinishedChanged: console.log("*** FINISHED: "+finished+" ***")
//onClearChanged: if (clear) {stationsModel.clear()}
query: "/result/station" query: "/result/station"
XmlRole { name: "stationuuid"; query: "@stationuuid/string()" } XmlRole { name: "stationuuid"; query: "@stationuuid/string()" }
XmlRole { name: "name"; query: "@name/string()" } XmlRole { name: "name"; query: "@name/string()" }
@ -52,10 +48,9 @@ XmlListModel {
"clicktrend" : get(i).clicktrend, "clicktrend" : get(i).clicktrend,
"clickcount" : get(i).clickcount, "clickcount" : get(i).clickcount,
"lastcheckok" : get(i).lastcheckok "lastcheckok" : get(i).lastcheckok
}) });
} }
finished = true finished = true
// console.log(" ***** APPENDED ******")
} }
} }

View File

@ -13,14 +13,10 @@ Item {
var filt var filt
for(var i = 0; i < xmlModel.count; i++) { for(var i = 0; i < xmlModel.count; i++) {
cname = getCountryName(xmlModel.get(i).name) cname = getCountryName(xmlModel.get(i).name)
//if (cname) filt = cname.toLowerCase()
if (cname) {filt = cname.toLowerCase(); if (filt.indexOf(filter) !== -1) countryModel.append({"name" : cname, "alpha_2" : xmlModel.get(i).name,"stationcount" : xmlModel.get(i).stationcount})} if (cname) {filt = cname.toLowerCase(); if (filt.indexOf(filter) !== -1) countryModel.append({"name" : cname, "alpha_2" : xmlModel.get(i).name,"stationcount" : xmlModel.get(i).stationcount})}
//console.log(cname)
} }
countryModel.listModelSort(countryModel, compareElements) countryModel.listModelSort(countryModel, compareElements)
//numberOfCountries = i radioBrowser.countryCount = countryModel.count
countryCount = countryModel.count
// console.log("COUNTRIESMODEL DONE: "+countryModel.count)
running = false running = false
} }
@ -49,18 +45,15 @@ Item {
XmlListModel { XmlListModel {
id: xmlModel id: xmlModel
query: "/result/countrycode" query: "/result/countrycode"
//source: radioServers.serverUrl + type + "/countrycodes?hidebroken=true"
XmlRole { name: "name"; query: "@name/string()" } XmlRole { name: "name"; query: "@name/string()" }
XmlRole { name: "stationcount"; query: "@stationcount/string()" } XmlRole { name: "stationcount"; query: "@stationcount/string()" }
onStatusChanged: { onStatusChanged: {
//if (status === XmlListModel.Loading) loadingInfo = "Preloading countries"
if (status === XmlListModel.Ready) { if (status === XmlListModel.Ready) {
addtomodel() addtomodel()
running = false running = false
} }
//if (status === XmlListModel.Loading) running = true;
} }
} }

View File

@ -510,8 +510,7 @@ ListModel {
qsTr("Kosovo"), qsTr("Kosovo"),
qsTr("No country") qsTr("No country")
] ]
} }
return countryname.text[index] return countryname.text[index]
} }
} }

View File

@ -2,22 +2,14 @@ import QtQuick 2.0
import QtQuick.XmlListModel 2.0 import QtQuick.XmlListModel 2.0
Item { Item {
// radio-browser advanced:
////property int bitrateMin: 0
////property int bitrateMax: 1000000
////property string state: ""
////property bool stateExact: false
////property string language: ""
////property bool languageExact: false
////property string tagList: "" // commaseparated string
property string name: "" property string name: ""
property bool nameExact: false property bool nameExact: false
property string countrycode: "" property string countrycode: ""
property string tag: "" property string tag: ""
property bool tagExcact: false property bool tagExcact: false
property string codec: "" property string codec: ""
property string order: "" // name, url, homepage, favicon, tags, country, state, language, votes, codec, bitrate, lastcheckok, lastchecktime, clicktimestamp, clickcount, clicktrend, random property string order: ""
property bool reverse: false//order === name ? false : true // true if name property bool reverse: false
property int offset: 0 property int offset: 0
property int limit: 150 property int limit: 150
property string source: "" property string source: ""
@ -43,7 +35,6 @@ Item {
if (order !== "") filterString = filterString + "&order="+order if (order !== "") filterString = filterString + "&order="+order
if (order === "name") reverse = false; else reverse = true if (order === "name") reverse = false; else reverse = true
filterString = filterString + "&reverse="+reverse + "&offset="+offset+"&limit="+limit filterString = filterString + "&reverse="+reverse + "&offset="+offset+"&limit="+limit
// console.log(radioBrowser.serverUrl + "/xml/stations/search?hidebroken=true"+filterString)
source = radioBrowser.serverUrl + "/xml/stations/search?hidebroken=true"+filterString source = radioBrowser.serverUrl + "/xml/stations/search?hidebroken=true"+filterString
} }
} }

View File

@ -35,55 +35,6 @@ Page {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
} }
/* Rectangle{
gradient: Gradient {
GradientStop { position: 0.0; color: "#333333" }
GradientStop { position: 1.0; color: "#777777" }
}
anchors {
horizontalCenter: parent.horizontalCenter
}
height: 3
width: parent.width-64
}
Label {
width: 360
font.pixelSize: Theme.fontSizeMedium
text: "Created by llelectronics"
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignHCenter
}
Repeater{
anchors.horizontalCenter: parent.horizontalCenter
//model: credits
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: title
font.pixelSize: Theme.fontSizeSmall
}
}
Rectangle{
gradient: Gradient {
GradientStop { position: 0.0; color: "#333333" }
GradientStop { position: 1.0; color: "#777777" }
}
anchors {
horizontalCenter: parent.horizontalCenter
}
height: 3
width: parent.width-64
}
Button {
id: homepage
anchors.horizontalCenter: parent.horizontalCenter
text: "<a href=\"https://github.com/llelectronics/webcat\">Sourcecode on Github</a>"
onClicked: {
mainWindow.openNewTab('page-'+salt(), "https://github.com/llelectronics/webcat", false);
}
} */
Label { Label {
width: parent.width-70 width: parent.width-70

View File

@ -43,30 +43,21 @@ Page {
onVisibleChanged: if (visible) reloadDbData() onVisibleChanged: if (visible) reloadDbData()
PullDownMenu { PullDownMenu {
MenuItem { MenuItem {
text: qsTr("About") text: qsTr("About")
onClicked: pageStack.push("AboutPage.qml") onClicked: pageStack.push("AboutPage.qml")
}
MenuItem {
text: qsTr("Settings")
onClicked: pageStack.push("SettingsPage.qml")
}
MenuItem {
text: qsTr("Sleep timer")
onClicked: {
pageStack.push("SleepTimerPage.qml")
} }
MenuItem { }
text: qsTr("Settings") }
onClicked: pageStack.push("SettingsPage.qml")
}
MenuItem {
text: qsTr("Sleep timer")
onClicked: {
pageStack.push("SleepTimerPage.qml")
}
/* var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", {
hour: 0,
minute: 30,
hourMode: DateTime.TwentyFourHours
})
dialog.accepted.connect(function() {
})
} */
}
}
Column { Column {
id: mainColumn id: mainColumn
@ -96,6 +87,7 @@ Page {
smooth: true smooth: true
source: "../images/community.png" source: "../images/community.png"
} }
ColorOverlay { ColorOverlay {
anchors.fill: logo anchors.fill: logo
source: logo source: logo
@ -178,11 +170,11 @@ Page {
height: Theme.itemSizeHuge * 1.35 height: Theme.itemSizeHuge * 1.35
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
visible: favorites.count > 0//radioBrowser.getCountryName(_country) || playedCountries.count > 0 ? true : false visible: favorites.count > 0
model: favorites model: favorites
@ -191,21 +183,18 @@ Page {
onClicked: { onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) { if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._countrycode = model.countrycode// THIS IS THE FUNCTION DESTROYING AARCH64?!?
radioPlayer._favicon = model.favicon radioPlayer._favicon = model.favicon
radioPlayer._name = model.name radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec) radioPlayer._codec = model.codec
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate) radioPlayer._bitrate = model.bitrate
radioPlayer._hls = model.hls radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid) radioPlayer.getStationFavorite(model.stationuuid)
radioPlayer.playlistIndex = index radioPlayer.playlistIndex = index
//console.log("Index: "+index)
} }
} }
} }
@ -216,7 +205,7 @@ Page {
HeaderButton { HeaderButton {
visible: radioPlayer.playHistory.count > 0 visible: radioPlayer.playHistory.count > 0
headerText: qsTr("Play history")//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country) headerText: qsTr("Play history")
onClicked: pageStack.push("HistoryPage.qml") onClicked: pageStack.push("HistoryPage.qml")
} }
@ -226,7 +215,7 @@ Page {
height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0 height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -236,18 +225,21 @@ Page {
delegate: SmallStationsDelegate { delegate: SmallStationsDelegate {
flagVisible: true flagVisible: true
onClicked: { onClicked: {
console.log("*** CLICKED")
if (model.url_resolved !== radioPlayer._url_resolved) { if (model.url_resolved !== radioPlayer._url_resolved) {
console.log("*** URL_RESOLVED")
radioPlayer._countrycode = model.countrycode// THIS IS THE FUNCTION DESTROYING AARCH64?!?
radioPlayer._favicon = model.favicon radioPlayer._favicon = model.favicon
radioPlayer._name = model.name radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec) radioPlayer._codec = model.codec
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate) radioPlayer._bitrate = model.bitrate
radioPlayer._hls = model.hls radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid) radioPlayer.getStationFavorite(model.stationuuid)
console.log("*** URL_RESOLVED END")
} }
} }
} }
@ -258,7 +250,7 @@ Page {
HeaderButton { HeaderButton {
visible: radioPlayer.playHistory.count > 0 visible: radioPlayer.playHistory.count > 0
headerText: qsTr("My most played Tags")//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country) headerText: qsTr("My most played Tags")
onClicked: pageStack.push("TagListPage.qml",{}) onClicked: pageStack.push("TagListPage.qml",{})
} }
@ -268,7 +260,7 @@ Page {
height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0 height: playedTags.count > 0 ? Theme.itemSizeHuge * 1.35 : 0
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -291,7 +283,7 @@ Page {
height: Theme.itemSizeHuge * 1.35 height: Theme.itemSizeHuge * 1.35
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -302,18 +294,21 @@ Page {
delegate: SmallStationsDelegate { delegate: SmallStationsDelegate {
flagVisible: false flagVisible: false
onClicked: { onClicked: {
console.log("*** CLICKED")
if (model.url_resolved !== radioPlayer._url_resolved) { if (model.url_resolved !== radioPlayer._url_resolved) {
console.log("*** URL_RESOLVED")
radioPlayer._countrycode = model.countrycode// THIS IS THE FUNCTION DESTROYING AARCH64?!?
radioPlayer._favicon = model.favicon radioPlayer._favicon = model.favicon
radioPlayer._name = model.name radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec) radioPlayer._codec = model.codec
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate) radioPlayer._bitrate = model.bitrate
radioPlayer._hls = model.hls radioPlayer._hls = model.hls
radioPlayer._url_resolved = model.url_resolved radioPlayer._url_resolved = model.url_resolved
radioPlayer._homepage = model.homepage radioPlayer._homepage = model.homepage
radioPlayer._stationuuid = model.stationuuid radioPlayer._stationuuid = model.stationuuid
radioPlayer.getStationFavorite(model.stationuuid) radioPlayer.getStationFavorite(model.stationuuid)
console.log("*** URL_RESOLVED END")
} }
} }
} }
@ -323,7 +318,6 @@ Page {
HeaderButton { HeaderButton {
visible: playedCountries.count > 1 visible: playedCountries.count > 1
// headerText: playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(1).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country)
headerText: playedCountries.count > 1 ? qsTr("Trending in")+" " + radioBrowser.getCountryName(playedCountries.get(1).alpha_2) : qsTr("Trending in")+" " + radioBrowser.getCountryName(_country) headerText: playedCountries.count > 1 ? qsTr("Trending in")+" " + radioBrowser.getCountryName(playedCountries.get(1).alpha_2) : qsTr("Trending in")+" " + radioBrowser.getCountryName(_country)
onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: playedCountries.get(1).alpha_2}) onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: playedCountries.get(1).alpha_2})
} }
@ -333,7 +327,7 @@ Page {
height: Theme.itemSizeHuge * 1.35 height: Theme.itemSizeHuge * 1.35
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -345,9 +339,9 @@ Page {
flagVisible: false flagVisible: false
onClicked: { onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) { if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._countrycode = model.countrycode// THIS IS THE FUNCTION DESTROYING AARCH64?!?
radioPlayer._favicon = model.favicon radioPlayer._favicon = model.favicon
radioPlayer._name = model.name radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec) radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate) radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
@ -364,7 +358,7 @@ Page {
Item {height: Theme.paddingLarge;width: parent.width} Item {height: Theme.paddingLarge;width: parent.width}
HeaderButton { HeaderButton {
headerText: qsTr("Trending in the world")//playedCountries.count > 0 ? "Trending in " + radioBrowser.getCountryName(playedCountries.get(0).alpha_2) : "Trending in " + radioBrowser.getCountryName(_country) headerText: qsTr("Trending in the world")
onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: ""}) onClicked: pageStack.push("CountryStationsPage.qml",{searchby:"clicktrend",_countrycode: ""})
} }
@ -373,7 +367,7 @@ Page {
height: Theme.itemSizeHuge * 1.35 height: Theme.itemSizeHuge * 1.35
width: page.width width: page.width
cellHeight: height cellHeight: height
cellWidth: cellHeight * 0.75//Theme.itemSizeHuge + Theme.itemSizeMedium * 2 cellWidth: cellHeight * 0.75
flow: GridView.TopToBottom flow: GridView.TopToBottom
snapMode: SlideshowView.NoSnap snapMode: SlideshowView.NoSnap
layoutDirection: Qt.LeftToRight layoutDirection: Qt.LeftToRight
@ -382,9 +376,9 @@ Page {
flagVisible: true flagVisible: true
onClicked: { onClicked: {
if (model.url_resolved !== radioPlayer._url_resolved) { if (model.url_resolved !== radioPlayer._url_resolved) {
radioPlayer._countrycode = model.countrycode// THIS IS THE FUNCTION DESTROYING AARCH64?!?
radioPlayer._favicon = model.favicon radioPlayer._favicon = model.favicon
radioPlayer._name = model.name radioPlayer._name = model.name
radioPlayer._countrycode = model.countrycode
radioPlayer._tags = model.tags radioPlayer._tags = model.tags
radioPlayer._codec = model.codec//getCodec(model.codec) radioPlayer._codec = model.codec//getCodec(model.codec)
radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate) radioPlayer._bitrate = model.bitrate //getBitrate(model.bitrate)
@ -404,8 +398,6 @@ Page {
Favorites.getTagsRecentClicked(playedTags,15) Favorites.getTagsRecentClicked(playedTags,15)
Favorites.getFavorites(favorites,"myclickcount",15) Favorites.getFavorites(favorites,"myclickcount",15)
Favorites.getCountryRecentClicked(playedCountries,4) Favorites.getCountryRecentClicked(playedCountries,4)
getTrending1.countrycode = playedCountries.count > 0 ? playedCountries.get(0).alpha_2 : _country getTrending1.countrycode = playedCountries.count > 0 ? playedCountries.get(0).alpha_2 : _country
getTrending1.order = "clicktrend" getTrending1.order = "clicktrend"
getTrending1.offset = 0 getTrending1.offset = 0

View File

@ -1,6 +1,7 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import QtQuick.LocalStorage 2.0 import QtQuick.LocalStorage 2.0
import "../helpers/db.js" as Favorites
import "../delegates" import "../delegates"
Page { Page {
@ -26,7 +27,7 @@ Page {
width: parent.width width: parent.width
placeholderText: "Search" placeholderText: "Search"
text: "" text: ""
inputMethodHints: Qt.ImhNoAutoUppercase //| Qt.ImhNoPredictiveText inputMethodHints: Qt.ImhNoAutoUppercase
EnterKey.iconSource: "image://theme/icon-m-enter-close" EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: {focus = false} EnterKey.onClicked: {focus = false}
focus: sfocus focus: sfocus
@ -42,7 +43,7 @@ Page {
onClicked: { onClicked: {
sfocus=false; sfocus=false;
settings.setValue("lastCountry",alpha_2) Favorites.setSetting("lastCountry",alpha_2)
pageStack.push("CountryStationsPage.qml",{stationCount: stationcount,_countrycode: alpha_2,searchby:"name"}) pageStack.push("CountryStationsPage.qml",{stationCount: stationcount,_countrycode: alpha_2,searchby:"name"})
} }
} }

View File

@ -8,7 +8,7 @@ Page {
property string filterby property string filterby
property alias searchby: getCountryStations.order property alias searchby: getCountryStations.order
property string searchtext: "" property string searchtext: ""
property string _countrycode: "" property string countrycode: ""
property int stationCount: 0 property int stationCount: 0
property alias name: getCountryStations.name property alias name: getCountryStations.name
property alias tag: getCountryStations.tag property alias tag: getCountryStations.tag
@ -47,8 +47,8 @@ Page {
ViewPlaceholder { ViewPlaceholder {
anchors.centerIn: parent anchors.centerIn: parent
enabled: view.count == 0 enabled: view.count == 0
text: getCountryStations.finished && view.count === 0 ? "Oh no..." : "Please wait" text: getCountryStations.finished && view.count === 0 ? qsTr("Oh no...") : qsTr("Please wait")
hintText: getCountryStations.finished && view.count === 0 ? "No radio stations!?!" : "getting radio stations" hintText: getCountryStations.finished && view.count === 0 ? qsTr("No radio stations!?!") : qsTr("getting radio stations")
} }
VerticalScrollDecorator {} VerticalScrollDecorator {}
@ -74,7 +74,7 @@ Page {
anchors.topMargin: Theme.paddingLarge anchors.topMargin: Theme.paddingLarge
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
anchors.rightMargin: Theme.paddingLarge//headerLogo.width + (Theme.paddingLarge * 2) anchors.rightMargin: Theme.paddingLarge
anchors.leftMargin: Theme.paddingLarge anchors.leftMargin: Theme.paddingLarge
Row { Row {
@ -86,7 +86,7 @@ Page {
height: ccode.height * 0.8 height: ccode.height * 0.8
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
smooth: true smooth: true
source: _countrycode === "" ? "../images/bycountry_t.png" : "../flags/"+_countrycode.toLowerCase()+".png" source: countrycode === "" ? "../images/bycountry_t.png" : "../flags/"+countrycode.toLowerCase()+".png"
} }
Label { Label {
id: ccode id: ccode
@ -94,7 +94,7 @@ Page {
color: Theme.highlightColor color: Theme.highlightColor
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
elide: Text.ElideLeft elide: Text.ElideLeft
text: getCountryStations.country //+ " ["+stationCount+"]" text: getCountryStations.country
} }
} }
Label { Label {
@ -102,7 +102,7 @@ Page {
color: Theme.secondaryHighlightColor color: Theme.secondaryHighlightColor
width: parent.width width: parent.width
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
text: sortedby//view.count + " channels" text: sortedby
} }
} }
} }
@ -112,7 +112,7 @@ Page {
width: parent.width width: parent.width
SearchField { SearchField {
id: sfield id: sfield
placeholderText: "Search" placeholderText: qsTr("Search")
inputMethodHints: Qt.ImhNoAutoUppercase inputMethodHints: Qt.ImhNoAutoUppercase
EnterKey.iconSource: "image://theme/icon-m-enter-close" EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: focus = false EnterKey.onClicked: focus = false
@ -148,8 +148,8 @@ Page {
label: "Search by:" label: "Search by:"
currentIndex: comboIndex currentIndex: comboIndex
menu: ContextMenu { menu: ContextMenu {
MenuItem { text: "Name" } MenuItem { text: qsTr("Name") }
MenuItem { text: "Tag" } MenuItem { text: qsTr("Tag") }
} }
onValueChanged: { onValueChanged: {
switch(currentIndex) { switch(currentIndex) {
@ -157,9 +157,9 @@ Page {
case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=sfield.text;getCountryStations.name="" case 1: filterby="tag";getCountryStations.offset=0;getCountryStations.tag=sfield.text;getCountryStations.name=""
} }
if (searchtext.length !== 0) { if (searchtext.length !== 0) {
getCountryStations.offset=0; getCountryStations.offset=0;
getCountryStations.clear = true getCountryStations.clear = true
getCountryStations.getStations() getCountryStations.getStations()
} }
} }
} }
@ -168,19 +168,19 @@ Page {
PullDownMenu { PullDownMenu {
MenuItem { MenuItem {
text: "Name" text: qsTr("Name")
onClicked: {getCountryStations.clear=true;getCountryStations.order = "name";getCountryStations.getStations()}//;xmlModel.running = true} onClicked: {getCountryStations.clear=true;getCountryStations.order = "name";getCountryStations.getStations()}//;xmlModel.running = true}
} }
MenuItem { MenuItem {
text: "Most likes" text: qsTr("Most likes")
onClicked: {getCountryStations.clear=true;getCountryStations.order = "votes";getCountryStations.getStations()}//;xmlModel.running = true} onClicked: {getCountryStations.clear=true;getCountryStations.order = "votes";getCountryStations.getStations()}//;xmlModel.running = true}
} }
MenuItem { MenuItem {
text: "Most played" text: qsTr("Most played")
onClicked: {getCountryStations.clear=true;getCountryStations.order = "clickcount";getCountryStations.getStations()}//xmlModel.running = true} onClicked: {getCountryStations.clear=true;getCountryStations.order = "clickcount";getCountryStations.getStations()}//xmlModel.running = true}
} }
MenuItem { MenuItem {
text: "Trending right now" text: qsTr("Trending right now")
onClicked: {getCountryStations.clear=true;getCountryStations.order = "clicktrend";getCountryStations.getStations()}//xmlModel.running = true} onClicked: {getCountryStations.clear=true;getCountryStations.order = "clicktrend";getCountryStations.getStations()}//xmlModel.running = true}
} }
} }
@ -205,8 +205,9 @@ Page {
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
getCountryStations.countrycode=_countrycode getCountryStations.countrycode=countrycode
getCountryStations.order=searchby getCountryStations.order=searchby
getCountryStations.getStations() getCountryStations.getStations()
} }

View File

@ -33,7 +33,7 @@ Page {
PageHeader { PageHeader {
id: pheader id: pheader
z: orientation === Orientation.Portrait || !screenTimer.running ? 98 : 0 z: orientation === Orientation.Portrait //|| !screenTimer.running ? 98 : 0
visible: orientation !== Orientation.LandscapeMask visible: orientation !== Orientation.LandscapeMask
Column { Column {
@ -263,9 +263,9 @@ Page {
id: sleeptimer id: sleeptimer
source: "image://theme/icon-s-timer" source: "image://theme/icon-s-timer"
height: play.height height: play.height
width: height width: favorite.height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.verticalCenter: play.verticalCenter anchors.verticalCenter: favorite.verticalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
@ -291,6 +291,7 @@ Page {
property bool returnValue: false property bool returnValue: false
source: returnValue ? "image://theme/icon-m-like" : "image://theme/icon-m-outline-like" source: returnValue ? "image://theme/icon-m-like" : "image://theme/icon-m-outline-like"
height: favorite.height height: favorite.height
anchors.verticalCenter: favorite.verticalCenter
width: height width: height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
onReturnValueChanged: console.log(" RETURN VALUE: "+upvote.returnValue) onReturnValueChanged: console.log(" RETURN VALUE: "+upvote.returnValue)

View File

@ -1062,6 +1062,49 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CountryStationsPage</name>
<message>
<source>Oh no...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please wait</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No radio stations!?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>getting radio stations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tag</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Most likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Most played</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Trending right now</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>FavoriteStations</name> <name>FavoriteStations</name>
<message> <message>

View File

@ -16,43 +16,43 @@
<name>AllRadio</name> <name>AllRadio</name>
<message> <message>
<source>About</source> <source>About</source>
<translation>Om</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Settings</source> <source>Settings</source>
<translation>Inställningar</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Sleep timer</source> <source>Sleep timer</source>
<translation>Insomningstimer</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Search</source> <source>Search</source>
<translation>Sök</translation> <translation type="unfinished">Sök</translation>
</message> </message>
<message> <message>
<source>Countries</source> <source>Countries</source>
<translation>Favoriter</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>My Favorites</source> <source>My Favorites</source>
<translation>Mina Favoriter</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Play history</source> <source>Play history</source>
<translation>Uppspelningshistorik</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>My most played Tags</source> <source>My most played Tags</source>
<translation>Mest spelade taggar</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Trending in</source> <source>Trending in</source>
<translation>Trendar i</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Trending in the world</source> <source>Trending in the world</source>
<translation>Trender i världen</translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>
@ -1062,6 +1062,49 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CountryStationsPage</name>
<message>
<source>Oh no...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please wait</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No radio stations!?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>getting radio stations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search</source>
<translation type="unfinished">Sök</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tag</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Most likes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Most played</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Trending right now</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>FavoriteStations</name> <name>FavoriteStations</name>
<message> <message>