Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
955442b8
Commit
955442b8
authored
Oct 26, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a module to export the playlist in HTML (feature requested on the forum).
parent
ebbd98f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
177 additions
and
8 deletions
+177
-8
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+20
-5
modules/misc/playlist/Modules.am
modules/misc/playlist/Modules.am
+1
-0
modules/misc/playlist/export.c
modules/misc/playlist/export.c
+10
-3
modules/misc/playlist/html.c
modules/misc/playlist/html.c
+146
-0
No files found.
modules/gui/qt4/dialogs_provider.cpp
View file @
955442b8
...
...
@@ -478,7 +478,9 @@ void DialogsProvider::saveAPlaylist()
qtr
(
"Save playlist as..."
),
qfu
(
p_intf
->
p_sys
->
psz_filepath
),
qtr
(
"XSPF playlist (*.xspf);; "
)
+
qtr
(
"M3U playlist (*.m3u);; Any (*.*) "
)
);
qtr
(
"M3U playlist (*.m3u);; "
)
+
qtr
(
"HTML playlist (*.html);;"
)
+
qtr
(
"Any (*.*) "
)
);
qfd
->
setFileMode
(
QFileDialog
::
AnyFile
);
qfd
->
setAcceptMode
(
QFileDialog
::
AcceptSave
);
qfd
->
setConfirmOverwrite
(
true
);
...
...
@@ -488,25 +490,38 @@ void DialogsProvider::saveAPlaylist()
if
(
qfd
->
selectedFiles
().
count
()
>
0
)
{
static
const
char
psz_xspf
[]
=
"export-xspf"
,
psz_m3u
[]
=
"export-m3u"
;
psz_m3u
[]
=
"export-m3u"
,
psz_html
[]
=
"export-html"
;
const
char
*
psz_module
;
QString
file
=
qfd
->
selectedFiles
().
first
();
QString
filter
=
qfd
->
selectedFilter
();
const
char
*
filt
=
filter
.
toAscii
();
if
(
file
.
contains
(
".xsp"
)
||
(
filter
.
contains
(
".xspf"
)
&&
!
file
.
contains
(
".m3u"
)
)
)
if
(
file
.
contains
(
".xsp"
)
||
filter
.
contains
(
"XSPF"
)
)
{
psz_module
=
psz_xspf
;
if
(
!
file
.
contains
(
".xsp"
)
)
file
.
append
(
".xspf"
);
}
else
else
if
(
file
.
contains
(
".m3u"
)
||
filter
.
contains
(
"M3U"
)
)
{
psz_module
=
psz_m3u
;
if
(
!
file
.
contains
(
".m3u"
)
)
file
.
append
(
".m3u"
);
}
else
if
(
file
.
contains
(
".html"
)
||
filter
.
contains
(
"HTML"
)
)
{
psz_module
=
psz_html
;
if
(
!
file
.
contains
(
"html"
)
)
file
.
append
(
".html"
);
}
else
{
msg_Err
(
p_intf
,
"Impossible to recognise the file type"
);
delete
qfd
;
return
;
}
playlist_Export
(
THEPL
,
qtu
(
toNativeSeparators
(
file
)
),
THEPL
->
p_local_category
,
psz_module
);
...
...
modules/misc/playlist/Modules.am
View file @
955442b8
SOURCES_export = \
export.c \
html.c \
m3u.c \
xspf.c \
xspf.h \
...
...
modules/misc/playlist/export.c
View file @
955442b8
...
...
@@ -36,6 +36,7 @@
***************************************************************************/
int
Export_M3U
(
vlc_object_t
*
p_intf
);
int
Export_Old
(
vlc_object_t
*
p_intf
);
int
Export_HTML
(
vlc_object_t
*
p_intf
);
int
xspf_export_playlist
(
vlc_object_t
*
p_intf
);
/*****************************************************************************
...
...
@@ -48,19 +49,25 @@ vlc_module_begin();
add_submodule
();
set_description
(
N_
(
"M3U playlist exporter"
)
);
add_shortcut
(
"export-m3u"
);
set_capability
(
"playlist export"
,
0
);
set_capability
(
"playlist export"
,
0
);
set_callbacks
(
Export_M3U
,
NULL
);
add_submodule
();
set_description
(
N_
(
"Old playlist exporter"
)
);
add_shortcut
(
"export-old"
);
set_capability
(
"playlist export"
,
0
);
set_capability
(
"playlist export"
,
0
);
set_callbacks
(
Export_Old
,
NULL
);
add_submodule
();
set_description
(
N_
(
"XSPF playlist export"
)
);
add_shortcut
(
"export-xspf"
);
set_capability
(
"playlist export"
,
0
);
set_capability
(
"playlist export"
,
0
);
set_callbacks
(
xspf_export_playlist
,
NULL
);
add_submodule
();
set_description
(
N_
(
"HTML playlist export"
)
);
add_shortcut
(
"export-html"
);
set_capability
(
"playlist export"
,
0
);
set_callbacks
(
Export_HTML
,
NULL
);
vlc_module_end
();
modules/misc/playlist/html.c
0 → 100644
View file @
955442b8
/*****************************************************************************
* html.c : HTML playlist export module
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <vlc_input.h>
#include <vlc_meta.h>
#include <vlc_strings.h>
// Export the playlist in HTML
int
Export_HTML
(
vlc_object_t
*
p_this
);
/**
* Recursiveyy follow the playlist
* @param p_playlist: the playlist
* @param p_export: the export structure
* @param p_root: the current node
*/
static
void
DoChildren
(
playlist_t
*
p_playlist
,
playlist_export_t
*
p_export
,
playlist_item_t
*
p_root
)
{
/* Go through the playlist and add items */
for
(
int
i
=
0
;
i
<
p_root
->
i_children
;
i
++
)
{
playlist_item_t
*
p_current
=
p_root
->
pp_children
[
i
];
assert
(
p_current
);
if
(
p_current
->
i_flags
&
PLAYLIST_SAVE_FLAG
)
continue
;
if
(
p_current
->
i_children
>=
0
)
{
DoChildren
(
p_playlist
,
p_export
,
p_current
);
continue
;
}
char
*
psz_name
=
NULL
;
char
*
psz_tmp
=
input_item_GetName
(
p_current
->
p_input
);
if
(
psz_tmp
)
psz_name
=
convert_xml_special_chars
(
psz_tmp
);
free
(
psz_tmp
);
if
(
psz_name
)
{
char
*
psz_artist
=
NULL
;
psz_tmp
=
input_item_GetArtist
(
p_current
->
p_input
);
if
(
psz_tmp
)
psz_artist
=
convert_xml_special_chars
(
psz_tmp
);
free
(
psz_tmp
);
mtime_t
i_duration
=
input_item_GetDuration
(
p_current
->
p_input
);
int
min
=
(
i_duration
/
1000000
)
/
60
;
int
sec
=
(
i_duration
/
1000000
)
-
min
*
60
;
// Print the artist if we have one
if
(
psz_artist
&&
*
psz_artist
)
fprintf
(
p_export
->
p_file
,
" <li>%s - %s (%02d:%02d)</li>
\n
"
,
psz_artist
,
psz_name
,
min
,
sec
);
else
fprintf
(
p_export
->
p_file
,
" <li>%s (%2d:%2d)</li>
\n
"
,
psz_name
,
min
,
sec
);
free
(
psz_artist
);
}
free
(
psz_name
);
}
}
/**
* Export the playlist as an HTML page
* @param p_this: the playlist
* @return VLC_SUCCESS if everything goes fine
*/
int
Export_HTML
(
vlc_object_t
*
p_this
)
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
p_this
;
playlist_export_t
*
p_export
=
(
playlist_export_t
*
)
p_playlist
->
p_private
;
msg_Dbg
(
p_playlist
,
"saving using HTML format"
);
/* Write header */
fprintf
(
p_export
->
p_file
,
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
"
"<!DOCTYPE html PUBLIC
\"
-//W3C//DTD XHTML 1.1//EN
\"
\"
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
\"
>
\n
"
"<html xmlns=
\"
http://www.w3.org/1999/xhtml
\"
xml:lang=
\"
en
\"
>
\n
"
"<head>
\n
"
" <meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html; charset=utf-8
\"
/>
\n
"
" <meta name=
\"
Generator
\"
content=
\"
VLC media player
\"
/>
\n
"
" <meta name=
\"
Author
\"
content=
\"
videolan@videolan.org (VideoLAN team)
\"
/>
\n
"
" <title>VLC generated playlist</title>
\n
"
" <style type=
\"
text/css
\"
>
\n
"
" body {
\n
"
" background-color: #E4F3FF;
\n
"
" font-family: sans-serif, Helvetica, Arial;
\n
"
" font-size: 13px;
\n
"
" }
\n
"
" h1 {
\n
"
" color: #2D58AE;
\n
"
" font-size: 25px;
\n
"
" }
\n
"
" hr {
\n
"
" color: #555555;
\n
"
" }
\n
"
" </style>
\n
"
"</head>
\n\n
"
"<body>
\n
"
" <h1>Playlist</h1>
\n
"
" <hr />
\n
"
" <ol>
\n
"
);
// Call the playlist constructor
DoChildren
(
p_playlist
,
p_export
,
p_export
->
p_root
);
// Print the footer
fprintf
(
p_export
->
p_file
,
" </ol>
\n
"
" <hr />
\n
"
"</body>
\n
"
"</html>"
);
return
VLC_SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment