Merge pull request #740 from whatdoineed2do/library-https-stream

[library] accept https:// streams
This commit is contained in:
Christian Meffert 2019-05-18 07:36:45 +02:00 committed by GitHub
commit cbd8d8a44d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 3 deletions

View File

@ -1716,7 +1716,7 @@ queue_add_stream(const char *path, int position, char reshuffle, uint32_t item_i
static int static int
queue_add(const char *uri, int position, char reshuffle, uint32_t item_id, int *count, int *new_item_id) queue_add(const char *uri, int position, char reshuffle, uint32_t item_id, int *count, int *new_item_id)
{ {
if (strncasecmp(uri, "http://", strlen("http://")) == 0) if (strncasecmp(uri, "http://", strlen("http://")) == 0 || strncasecmp(uri, "https://", strlen("https://")) == 0)
{ {
queue_add_stream(uri, position, reshuffle, item_id, count, new_item_id); queue_add_stream(uri, position, reshuffle, item_id, count, new_item_id);
return LIBRARY_OK; return LIBRARY_OK;
@ -1903,7 +1903,7 @@ playlist_add_files(FILE *fp, int pl_id, const char *virtual_path)
DPRINTF(E_DBG, L_SCAN, "Item '%s' added to playlist (id = %d)\n", dbmfi.path, pl_id); DPRINTF(E_DBG, L_SCAN, "Item '%s' added to playlist (id = %d)\n", dbmfi.path, pl_id);
} }
} }
else if (strncasecmp(virtual_path, "/http://", strlen("/http://")) == 0) else if (strncasecmp(virtual_path, "/http://", strlen("/http://")) == 0 || strncasecmp(virtual_path, "/https://", strlen("/https://")) == 0)
{ {
path = (virtual_path + 1); path = (virtual_path + 1);

View File

@ -0,0 +1,54 @@
<template>
<div>
<transition name="fade">
<div class="modal is-active" v-if="show">
<div class="modal-background" @click="$emit('close')"></div>
<div class="modal-card">
<section class="modal-card-body">
<form v-on:submit.prevent="add_stream">
<div class="field">
<p class="control is-expanded has-icons-left">
<input class="input is-rounded is-shadowless" type="text" placeholder="URL stream" v-model="url" ref="url_field">
<span class="icon is-left">
<i class="mdi mdi-file-music"></i>
</span>
</p>
</div>
</form>
</section>
<footer class="modal-card-foot">
<button class="button is-success" @click="add_stream" :disabled="url.length < 9">Add</button>
<button class="button" @click="$emit('close')">Cancel</button>
</footer>
</div>
<button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button>
</div>
</transition>
</div>
</template>
<script>
import webapi from '@/webapi'
export default {
name: 'ModalDialogAddUrlStream',
props: [ 'show' ],
data () {
return {
url: ''
}
},
methods: {
add_stream: function () {
this.$emit('close')
webapi.queue_add(this.url)
this.url = ''
}
}
}
</script>
<style>
</style>

View File

@ -12,6 +12,12 @@
</span> </span>
<span>Hide previous</span> <span>Hide previous</span>
</a> </a>
<a class="button is-small" @click="add_stream_dialog">
<span class="icon">
<i class="mdi mdi-web"></i>
</span>
<span>Add URL Stream</span>
</a>
<!-- <!--
<a class="button" :class="{ 'is-info': edit_mode }" @click="edit_mode = !edit_mode"> <a class="button" :class="{ 'is-info': edit_mode }" @click="edit_mode = !edit_mode">
<span class="icon"> <span class="icon">
@ -60,19 +66,21 @@
import ContentWithHeading from '@/templates/ContentWithHeading' import ContentWithHeading from '@/templates/ContentWithHeading'
import ListItemQueueItem from '@/components/ListItemQueueItem' import ListItemQueueItem from '@/components/ListItemQueueItem'
import ModalDialogQueueItem from '@/components/ModalDialogQueueItem' import ModalDialogQueueItem from '@/components/ModalDialogQueueItem'
import ModalDialogAddUrlStream from '@/components/ModalDialogAddUrlStream'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
export default { export default {
name: 'PageQueue', name: 'PageQueue',
components: { ContentWithHeading, ListItemQueueItem, draggable, ModalDialogQueueItem }, components: { ContentWithHeading, ListItemQueueItem, draggable, ModalDialogQueueItem, ModalDialogAddUrlStream },
data () { data () {
return { return {
edit_mode: false, edit_mode: false,
show_details_modal: false, show_details_modal: false,
show_url_modal: false,
selected_item: {} selected_item: {}
} }
}, },
@ -122,6 +130,10 @@ export default {
open_dialog: function (item) { open_dialog: function (item) {
this.selected_item = item this.selected_item = item
this.show_details_modal = true this.show_details_modal = true
},
add_stream_dialog: function (item) {
this.show_url_modal = true
} }
} }
} }