Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
medialibrary
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
57
Issues
57
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
medialibrary
Commits
5b295b7d
Commit
5b295b7d
authored
Sep 30, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide file/line/func when logging
parent
2da189c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
17 deletions
+21
-17
src/AlbumTrack.cpp
src/AlbumTrack.cpp
+1
-1
src/File.cpp
src/File.cpp
+2
-2
src/MediaLibrary.cpp
src/MediaLibrary.cpp
+3
-3
src/database/SqliteTools.h
src/database/SqliteTools.h
+5
-5
src/logging/Logger.h
src/logging/Logger.h
+4
-0
src/metadata_services/vlc/VLCMetadataService.cpp
src/metadata_services/vlc/VLCMetadataService.cpp
+6
-6
No files found.
src/AlbumTrack.cpp
View file @
5b295b7d
...
...
@@ -98,7 +98,7 @@ bool AlbumTrack::destroy()
// Manually remove Files from cache, and let foreign key handling delete them from the DB
auto
fs
=
files
();
if
(
fs
.
size
()
==
0
)
L
og
::
Warning
(
"No files found for AlbumTrack "
,
m_id
);
L
OG_WARN
(
"No files found for AlbumTrack "
,
m_id
);
for
(
auto
&
f
:
fs
)
{
// Ignore failures to discard from cache, we might want to discard records from
...
...
src/File.cpp
View file @
5b295b7d
...
...
@@ -313,7 +313,7 @@ bool File::addLabel( LabelPtr label )
{
if
(
m_id
==
0
||
label
->
id
()
==
0
)
{
L
og
::
Error
(
"Both file & label need to be inserted in database before being linked together"
);
L
OG_ERROR
(
"Both file & label need to be inserted in database before being linked together"
);
return
false
;
}
const
char
*
req
=
"INSERT INTO LabelFileRelation VALUES(?, ?)"
;
...
...
@@ -324,7 +324,7 @@ bool File::removeLabel( LabelPtr label )
{
if
(
m_id
==
0
||
label
->
id
()
==
0
)
{
L
og
::
Error
(
"Can't unlink a label/file not inserted in database"
);
L
OG_ERROR
(
"Can't unlink a label/file not inserted in database"
);
return
false
;
}
const
char
*
req
=
"DELETE FROM LabelFileRelation WHERE id_label = ? AND id_file = ?"
;
...
...
src/MediaLibrary.cpp
View file @
5b295b7d
...
...
@@ -98,7 +98,7 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& sna
m_dbConnection
.
reset
(
dbConnection
,
&
sqlite3_close
);
if
(
sqlite
::
Tools
::
executeRequest
(
DBConnection
(
m_dbConnection
),
"PRAGMA foreign_keys = ON"
)
==
false
)
{
L
og
::
Error
(
"Failed to enable foreign keys"
);
L
OG_ERROR
(
"Failed to enable foreign keys"
);
return
false
;
}
if
(
!
(
File
::
createTable
(
m_dbConnection
)
&&
...
...
@@ -112,7 +112,7 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& sna
VideoTrack
::
createTable
(
m_dbConnection
)
&&
AudioTrack
::
createTable
(
m_dbConnection
)
)
)
{
L
og
::
Error
(
"Failed to create database structure"
);
L
OG_ERROR
(
"Failed to create database structure"
);
return
false
;
}
return
loadFolders
();
...
...
@@ -372,7 +372,7 @@ FilePtr MediaLibrary::addFile( const fs::IFile* file, unsigned int folderId )
auto
fptr
=
File
::
create
(
m_dbConnection
,
file
,
folderId
);
if
(
fptr
==
nullptr
)
{
L
og
::
Error
(
"Failed to add file "
,
file
->
fullPath
(),
" to the media library"
);
L
OG_ERROR
(
"Failed to add file "
,
file
->
fullPath
(),
" to the media library"
);
return
nullptr
;
}
// Keep in mind that this is queued by the parser thread, there is no waranty about
...
...
src/database/SqliteTools.h
View file @
5b295b7d
...
...
@@ -197,7 +197,7 @@ class Tools
int
res
=
sqlite3_prepare_v2
(
dbConnection
.
get
(),
req
.
c_str
(),
-
1
,
&
stmt
,
NULL
);
if
(
res
!=
SQLITE_OK
)
{
L
og
::
Error
(
"Failed to execute request: "
,
req
,
L
OG_ERROR
(
"Failed to execute request: "
,
req
,
sqlite3_errmsg
(
dbConnection
.
get
()
)
);
}
return
StmtPtr
(
stmt
,
&
sqlite3_finalize
);
...
...
@@ -224,13 +224,13 @@ class Tools
}
while
(
res
==
SQLITE_ROW
);
if
(
res
!=
SQLITE_DONE
)
{
Log
::
Error
(
"Failed to execute <"
,
req
,
">
\n
Invalid result: "
,
#if SQLITE_VERSION_NUMBER >= 3007015
sqlite3_errstr
(
res
)
auto
err
=
sqlite3_errstr
(
res
);
#else
res
auto
err
=
res
;
#endif
,
": "
,
sqlite3_errmsg
(
dbConnection
.
get
()
)
);
LOG_ERROR
(
"Failed to execute <"
,
req
,
">
\n
Invalid result: "
,
err
,
": "
,
sqlite3_errmsg
(
dbConnection
.
get
()
)
);
return
false
;
}
return
true
;
...
...
src/logging/Logger.h
View file @
5b295b7d
...
...
@@ -89,3 +89,7 @@ private:
static
std
::
unique_ptr
<
ILogger
>
s_defaultLogger
;
static
std
::
atomic
<
ILogger
*>
s_logger
;
};
#define LOG_ERROR( ... ) Log::Error( __FILE__, ":", __LINE__, ' ', __func__, __VA_ARGS__ )
#define LOG_WARN( ... ) Log::Warning( __FILE__, ":", __LINE__, ' ', __func__, __VA_ARGS__ )
#define LOG_INFO( ... ) Log::Info( __FILE__, ":", __LINE__, ' ', __func__, __VA_ARGS__ )
src/metadata_services/vlc/VLCMetadataService.cpp
View file @
5b295b7d
...
...
@@ -67,7 +67,7 @@ ServiceStatus VLCMetadataService::handleMediaMeta( FilePtr file, VLC::Media& med
auto
tracks
=
media
.
tracks
();
if
(
tracks
.
size
()
==
0
)
{
L
og
::
Error
(
"Failed to fetch tracks"
);
L
OG_ERROR
(
"Failed to fetch tracks"
);
return
StatusFatal
;
}
bool
isAudio
=
true
;
...
...
@@ -115,14 +115,14 @@ bool VLCMetadataService::parseAudioFile( FilePtr file, VLC::Media& media ) const
album
=
m_ml
->
createAlbum
(
albumTitle
);
if
(
album
==
nullptr
)
{
L
og
::
Error
(
"Failed to create/get album"
);
L
OG_ERROR
(
"Failed to create/get album"
);
return
false
;
}
auto
trackNbStr
=
media
.
meta
(
libvlc_meta_TrackNumber
);
if
(
trackNbStr
.
length
()
==
0
)
{
L
og
::
Error
(
"Failed to get track id"
);
L
OG_ERROR
(
"Failed to get track id"
);
return
false
;
}
auto
artwork
=
media
.
meta
(
libvlc_meta_ArtworkURL
);
...
...
@@ -132,7 +132,7 @@ bool VLCMetadataService::parseAudioFile( FilePtr file, VLC::Media& media ) const
auto
title
=
media
.
meta
(
libvlc_meta_Title
);
if
(
title
.
length
()
==
0
)
{
L
og
::
Error
(
"Failed to compute track title"
);
L
OG_ERROR
(
"Failed to compute track title"
);
title
=
"Unknown track #"
;
title
+=
trackNbStr
;
}
...
...
@@ -140,7 +140,7 @@ bool VLCMetadataService::parseAudioFile( FilePtr file, VLC::Media& media ) const
auto
track
=
album
->
addTrack
(
title
,
trackNb
);
if
(
track
==
nullptr
)
{
L
og
::
Error
(
"Failure while creating album track"
);
L
OG_ERROR
(
"Failure while creating album track"
);
return
false
;
}
file
->
setAlbumTrack
(
track
);
...
...
@@ -179,7 +179,7 @@ bool VLCMetadataService::parseVideoFile( FilePtr file, VLC::Media& media ) const
int
episodeId
=
std
::
stoi
(
episodeIdStr
,
&
endpos
);
if
(
endpos
!=
episodeIdStr
.
length
()
)
{
L
og
::
Error
(
"Invalid episode id provided"
);
L
OG_ERROR
(
"Invalid episode id provided"
);
return
true
;
}
show
->
addEpisode
(
title
,
episodeId
);
...
...
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