Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
2fe4350e
Commit
2fe4350e
authored
Jul 13, 2018
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist: Don't store external media type as Unknown
Use External instead, since that's what they are
parent
cb253ce8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
src/database/migrations/migration13-14.sql
src/database/migrations/migration13-14.sql
+9
-0
src/metadata_services/MetadataParser.cpp
src/metadata_services/MetadataParser.cpp
+1
-1
test/unittest/MiscTests.cpp
test/unittest/MiscTests.cpp
+9
-2
test/unittest/db_v13.sql
test/unittest/db_v13.sql
+5
-0
No files found.
src/database/migrations/migration13-14.sql
View file @
2fe4350e
...
...
@@ -41,6 +41,15 @@
"DROP TABLE "
+
MediaTable
::
Name
+
"_backup"
,
/************ Playlist external media were stored as Unknown ******************/
"UPDATE "
+
policy
::
MediaTable
::
Name
+
" SET type = "
+
std
::
to_string
(
static_cast
<
typename
std
::
underlying_type
<
IMedia
::
Type
>
::
type
>
(
IMedia
::
Type
::
External
)
)
+
" "
"WHERE id_media IN (SELECT media_id FROM PlaylistMediaRelation) AND "
"type = "
+
std
::
to_string
(
static_cast
<
typename
std
::
underlying_type
<
IMedia
::
Type
>
::
type
>
(
IMedia
::
Type
::
Unknown
)
),
/******************* Migrate metadata table ***********************************/
"CREATE TEMPORARY TABLE "
+
MetadataTable
::
Name
+
"_backup"
"("
...
...
src/metadata_services/MetadataParser.cpp
View file @
2fe4350e
...
...
@@ -304,7 +304,7 @@ void MetadataAnalyzer::addPlaylistElement( IItem& item,
if
(
fsFactory
==
nullptr
)
// Media not supported by any FsFactory, registering it as external
{
auto
t2
=
m_ml
->
getConn
()
->
newTransaction
();
auto
externalMedia
=
Media
::
create
(
m_ml
,
IMedia
::
Type
::
Unknown
,
utils
::
url
::
encode
(
auto
externalMedia
=
Media
::
create
(
m_ml
,
IMedia
::
Type
::
External
,
utils
::
url
::
encode
(
subitem
.
meta
(
IItem
::
Metadata
::
Title
)
)
);
if
(
externalMedia
==
nullptr
)
{
...
...
test/unittest/MiscTests.cpp
View file @
2fe4350e
...
...
@@ -183,7 +183,7 @@ TEST_F( DbModel, Upgrade13to14 )
auto
res
=
ml
->
initialize
(
"test.db"
,
"/tmp"
,
cbMock
.
get
()
);
ASSERT_EQ
(
InitializeResult
::
Success
,
res
);
auto
media
=
ml
->
files
();
ASSERT_EQ
(
2
u
,
media
.
size
()
);
ASSERT_EQ
(
4
u
,
media
.
size
()
);
auto
m
=
media
[
0
];
ASSERT_EQ
(
m
->
thumbnail
(),
"/path/to/thumbnail"
);
ASSERT_TRUE
(
m
->
isThumbnailGenerated
()
);
...
...
@@ -200,9 +200,16 @@ TEST_F( DbModel, Upgrade13to14 )
auto
playlists
=
ml
->
playlists
(
nullptr
)
->
all
();
ASSERT_EQ
(
1u
,
playlists
.
size
()
);
auto
playlistMedia
=
playlists
[
0
]
->
media
()
->
all
();
ASSERT_EQ
(
2
u
,
playlistMedia
.
size
()
);
ASSERT_EQ
(
3
u
,
playlistMedia
.
size
()
);
ASSERT_EQ
(
media
[
0
]
->
id
(),
playlistMedia
[
0
]
->
id
()
);
ASSERT_EQ
(
media
[
1
]
->
id
(),
playlistMedia
[
1
]
->
id
()
);
ASSERT_EQ
(
media
[
2
]
->
id
(),
playlistMedia
[
2
]
->
id
()
);
ASSERT_EQ
(
IMedia
::
Type
::
External
,
media
[
2
]
->
type
()
);
auto
externalMedia
=
ml
->
media
(
99
);
ASSERT_NE
(
nullptr
,
externalMedia
);
ASSERT_EQ
(
IMedia
::
Type
::
Unknown
,
externalMedia
->
type
()
);
CheckNbTriggers
(
32
);
}
test/unittest/db_v13.sql
View file @
2fe4350e
...
...
@@ -77,8 +77,13 @@ INSERT INTO `Media` (id_media,type,subtype,duration,play_count,last_played_date,
INSERT
INTO
`File`
(
id_file
,
media_id
,
playlist_id
,
mrl
,
type
,
last_modification_date
,
size
,
folder_id
,
is_present
,
is_removable
,
is_external
)
VALUES
(
1
,
1
,
NULL
,
'media.avi'
,
1
,
NULL
,
NULL
,
NULL
,
1
,
0
,
1
);
INSERT
INTO
`Media`
(
id_media
,
type
,
subtype
,
duration
,
play_count
,
last_played_date
,
insertion_date
,
release_date
,
thumbnail
,
title
,
filename
,
is_favorite
,
is_present
)
VALUES
(
2
,
3
,
NULL
,
-
1
,
NULL
,
NULL
,
1522231538
,
NULL
,
''
,
'media2.avi'
,
'media2.avi'
,
0
,
1
);
INSERT
INTO
`File`
(
id_file
,
media_id
,
playlist_id
,
mrl
,
type
,
last_modification_date
,
size
,
folder_id
,
is_present
,
is_removable
,
is_external
)
VALUES
(
2
,
2
,
NULL
,
'media2.avi'
,
1
,
NULL
,
NULL
,
NULL
,
1
,
0
,
1
);
INSERT
INTO
`Media`
(
id_media
,
type
,
subtype
,
duration
,
play_count
,
last_played_date
,
insertion_date
,
release_date
,
thumbnail
,
title
,
filename
,
is_favorite
,
is_present
)
VALUES
(
3
,
0
,
NULL
,
-
1
,
NULL
,
NULL
,
1522231538
,
NULL
,
''
,
'external.avi'
,
'external.avi'
,
0
,
1
);
INSERT
INTO
`File`
(
id_file
,
media_id
,
playlist_id
,
mrl
,
type
,
last_modification_date
,
size
,
folder_id
,
is_present
,
is_removable
,
is_external
)
VALUES
(
3
,
3
,
NULL
,
'external.avi'
,
1
,
NULL
,
NULL
,
NULL
,
1
,
0
,
1
);
INSERT
INTO
`Media`
(
id_media
,
type
,
subtype
,
duration
,
play_count
,
last_played_date
,
insertion_date
,
release_date
,
thumbnail
,
title
,
filename
,
is_favorite
,
is_present
)
VALUES
(
99
,
0
,
NULL
,
-
1
,
NULL
,
NULL
,
1522231538
,
NULL
,
''
,
'other_external.avi'
,
'other_external.avi'
,
0
,
1
);
INSERT
INTO
`File`
(
id_file
,
media_id
,
playlist_id
,
mrl
,
type
,
last_modification_date
,
size
,
folder_id
,
is_present
,
is_removable
,
is_external
)
VALUES
(
99
,
99
,
NULL
,
'other_external.avi'
,
1
,
NULL
,
NULL
,
NULL
,
1
,
0
,
1
);
INSERT
INTO
`MediaMetadata`
VALUES
(
2
,
50
,
"fake progress"
);
INSERT
INTO
`Playlist`
(
id_playlist
,
name
,
file_id
,
creation_date
,
artwork_mrl
)
VALUES
(
1
,
'test playlist'
,
NULL
,
1530864508
,
''
);
INSERT
INTO
`PlaylistMediaRelation`
(
media_id
,
playlist_id
,
position
)
VALUES
(
1
,
1
,
1
);
INSERT
INTO
`PlaylistMediaRelation`
(
media_id
,
playlist_id
,
position
)
VALUES
(
2
,
1
,
2
);
INSERT
INTO
`PlaylistMediaRelation`
(
media_id
,
playlist_id
,
position
)
VALUES
(
3
,
1
,
3
);
COMMIT
;
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