Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
6c4ccdee
Commit
6c4ccdee
authored
Mar 08, 2018
by
Pierre SAGASPE
Browse files
VLCHTTPConnection : replacing stringByAddingPercentEscapesUsingEncoding deprecated
parent
071b6880
Changes
1
Hide whitespace changes
Inline
Side-by-side
Sources/VLCHTTPConnection.m
View file @
6c4ccdee
...
...
@@ -2,7 +2,7 @@
* VLCHTTPConnection.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013-201
5
VideoLAN. All rights reserved.
* Copyright (c) 2013-201
8
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
...
...
@@ -129,7 +129,7 @@
#if TARGET_OS_IOS
-
(
NSObject
<
HTTPResponse
>
*
)
_httpGETDownloadForPath
:(
NSString
*
)
path
{
NSString
*
filePath
=
[[
path
stringByReplacingOccurrencesOfString
:
@"/download/"
withString
:
@""
]
stringBy
Replac
ingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
];
NSString
*
filePath
=
[[
path
stringByReplacingOccurrencesOfString
:
@"/download/"
withString
:
@""
]
stringBy
Add
ingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
];
if
(
!
[
self
fileIsInDocumentFolder
:
filePath
])
{
//return nil which gets handled as resource not found
return
nil
;
...
...
@@ -141,7 +141,7 @@
-
(
NSObject
<
HTTPResponse
>
*
)
_httpGETThumbnailForPath
:(
NSString
*
)
path
{
NSString
*
filePath
=
[[
path
stringByReplacingOccurrencesOfString
:
@"/thumbnail/"
withString
:
@""
]
stringBy
Replac
ingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
];
NSString
*
filePath
=
[[
path
stringByReplacingOccurrencesOfString
:
@"/thumbnail/"
withString
:
@""
]
stringBy
Add
ingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
];
filePath
=
[
filePath
stringByReplacingOccurrencesOfString
:
@".png"
withString
:
@""
];
NSManagedObjectContext
*
moc
=
[[
MLMediaLibrary
sharedMediaLibrary
]
managedObjectContext
];
...
...
@@ -233,14 +233,14 @@
</a> \
</div>"
,
file
.
objectID
.
URIRepresentation
,
[
file
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
[
file
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
file
.
title
,
duration
,
(
float
)(
file
.
fileSizeInBytes
/
1e6
)]];
if
(
shouldReturnLibVLCXML
)
{
NSString
*
pathSub
=
[
self
_checkIfSubtitleWasFound
:
file
.
path
];
if
(
pathSub
)
pathSub
=
[
NSString
stringWithFormat
:
@"http://%@/download/%@"
,
hostName
,
pathSub
];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
file
.
title
,
hostName
,
file
.
objectID
.
URIRepresentation
.
absoluteString
,
duration
,
file
.
fileSizeInBytes
,
hostName
,
[
file
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
pathSub
]];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
file
.
title
,
hostName
,
file
.
objectID
.
URIRepresentation
.
absoluteString
,
duration
,
file
.
fileSizeInBytes
,
hostName
,
[
file
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
pathSub
]];
}
}
else
if
([
mo
isKindOfClass
:[
MLShow
class
]])
{
...
...
@@ -273,7 +273,7 @@
</a> \
</div>"
,
showEp
.
objectID
.
URIRepresentation
,
[
anyFileFromEpisode
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
[
anyFileFromEpisode
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
showEp
.
seasonNumber
,
showEp
.
episodeNumber
,
showEp
.
name
,
...
...
@@ -282,7 +282,7 @@
NSString
*
pathSub
=
[
self
_checkIfSubtitleWasFound
:[
anyFileFromEpisode
path
]];
if
(
!
[
pathSub
isEqualToString
:
@""
])
pathSub
=
[
NSString
stringWithFormat
:
@"http://%@/download/%@"
,
hostName
,
pathSub
];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@ - S%@E%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
show
.
name
,
showEp
.
seasonNumber
,
showEp
.
episodeNumber
,
hostName
,
showEp
.
objectID
.
URIRepresentation
,
duration
,
[
anyFileFromEpisode
fileSizeInBytes
],
hostName
,
[
anyFileFromEpisode
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
pathSub
]];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@ - S%@E%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
show
.
name
,
showEp
.
seasonNumber
,
showEp
.
episodeNumber
,
hostName
,
showEp
.
objectID
.
URIRepresentation
,
duration
,
[
anyFileFromEpisode
fileSizeInBytes
],
hostName
,
[
anyFileFromEpisode
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
pathSub
]];
}
}
[
mediaInHtml
addObject
:
@"</div></div>"
];
...
...
@@ -315,14 +315,14 @@
</a> \
</div>"
,
file
.
objectID
.
URIRepresentation
,
[
file
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
[
file
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
file
.
title
,
duration
,
(
float
)(
file
.
fileSizeInBytes
/
1e6
)]];
if
(
shouldReturnLibVLCXML
)
{
NSString
*
pathSub
=
[
self
_checkIfSubtitleWasFound
:
file
.
path
];
if
(
pathSub
)
pathSub
=
[
NSString
stringWithFormat
:
@"http://%@/download/%@"
,
hostName
,
pathSub
];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
file
.
title
,
hostName
,
file
.
objectID
.
URIRepresentation
,
duration
,
file
.
fileSizeInBytes
,
hostName
,
[
file
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
pathSub
]];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"
%@
\"
/>"
,
file
.
title
,
hostName
,
file
.
objectID
.
URIRepresentation
,
duration
,
file
.
fileSizeInBytes
,
hostName
,
[
file
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
pathSub
]];
}
}
[
mediaInHtml
addObject
:
@"</div></div>"
];
...
...
@@ -356,11 +356,11 @@
</a> \
</div>"
,
track
.
objectID
.
URIRepresentation
,
[
anyFileFromTrack
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
],
[
anyFileFromTrack
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
],
track
.
title
,
duration
,
(
float
)([
anyFileFromTrack
fileSizeInBytes
]
/
1e6
)]];
if
(
shouldReturnLibVLCXML
)
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"\"
/>"
,
track
.
title
,
hostName
,
track
.
objectID
.
URIRepresentation
,
duration
,
[
anyFileFromTrack
fileSizeInBytes
],
hostName
,
[
anyFileFromTrack
.
url
.
path
stringByAddingPercentE
scapesUsingEncoding
:
NSUTF8StringEncoding
]]];
[
mediaInXml
addObject
:[
NSString
stringWithFormat
:
@"<Media title=
\"
%@
\"
thumb=
\"
http://%@/thumbnail/%@.png
\"
duration=
\"
%@
\"
size=
\"
%li
\"
pathfile=
\"
http://%@/download/%@
\"
pathSubtitle=
\"\"
/>"
,
track
.
title
,
hostName
,
track
.
objectID
.
URIRepresentation
,
duration
,
[
anyFileFromTrack
fileSizeInBytes
],
hostName
,
[
anyFileFromTrack
.
url
.
path
stringByAddingPercentE
ncodingWithAllowedCharacters
:
NSCharacterSet
.
URLFragmentAllowedCharacterSet
]]];
}
[
mediaInHtml
addObject
:
@"</div></div>"
];
}
...
...
Pierre SAGASPE
@Pierre
mentioned in commit
71bae864
·
Mar 09, 2018
mentioned in commit
71bae864
mentioned in commit 71bae864ff51f6902071916d7108f8d3c494c023
Toggle commit list
Write
Preview
Supports
Markdown
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