Media Storage and Media Picker in Orchard CMS - storage

crosspost: https://orchard.codeplex.com/discussions/471948
We just noticed that some files listed when visiting folders under Media Storage are not always listed in the Media Picker modal. I did some tinkering myself and found out that if you upload files via Media Storage -> Select Folder -> Add Media, it doesn't get listed at all, as opposed to going onto Media Picker -> Select Folder -> Import.
Correct me if I'm wrong but I remember one of the changes in 1.7 is that media is now treated as a Content Type as opposed to having the picker just crawl through folders. Does this have anything to do with it? (i.e. Media Storage just uploads the file, Media Picker import adds the CT and lists it)
Any piece of information would be highly appreciated, thanks!

You got this right: media storage is an obsolete feature that should not be used once you've switched to the media library. It's really the old module, that manages only files, not content items.

Related

Umbraco: Saving media, not added to cache?

I have a script that imports some legacy media into Umbraco media library. File gets saved, and is vissible in the backend, and when I access the direct url mywebsite.com/media/[id]/myfile.pdf - the file is loaded correct.
But, if I use the media (file or image) on the site, an image for instance, the image does not get shown. If i then find the image in the backend media library, clicks save, and nothing more, it works for that image.
But as there is 1000+ media files, this is not really an option to do manually.
I tried rebuilding the examine indexes, all of them, deleting them, deleting umbraco.config, temp folders etc.
Tried a small script that loops through all media files and saves them again mediaService.Save(mediaItem), but nothing works.
What am I missing?

Where to find/Location of Firefox Extension Data (other than profileName/browser-extension-data)

I wish to find data inserted into a Mozilla Firefox extension "Hide Spoilers!". It contains words onto which spoiler shadow is cast.
Some of my other extension inserted-data can be found at:
C:\Users\[ME]\AppData\Roaming\Mozilla\Firefox\Profiles\[PROFILE.NAME]\browser-extension-data
Therefore, the data's stored in storage.js file
The data usually consists of key-words and phrases (namely, in one of my other extensions that also serves a similar anti-spoiler fashion).
This extension, however, stores such data in another fashion.
I'm sure of that being true because, after manually moving out the extension file from
C:\Users[ME]\AppData\Roaming\Mozilla\Firefox\Profiles[PROFILE.NAME]\extensions
and after reinstalling the extension at addons.mozila , the aforementioned inserted-data persisted.
I believe it's the moz-extension+++ folders in the storage folder in your profile folder:
C:\Users\[user]\AppData\Roaming\Mozilla\Firefox\Profiles\[profile]\storage\default
You can generate a list of UUIDs belonging to each of your extensions by pasting that into your browser's address bar:
about:debugging#/runtime/this-firefox
Those UUIDs should match up with the folders to determine which folder belongs to which extension.

Web view UWP not loading files in the machine

can I open a html file on the C drive or on any location using the web view in UWP?
I am using the following code but it is not working:
Uri targeturi = new Uri("C:/Users/user/Pictures/Files/Forms/dac36cac-5d83-4fae-bf4f-112361b719ea/index.html");
browser.Navigate(targeturi);
In uwp files have limited access permission. By the default the app can only access the application install directory and data locations. Additional locations require special capabilities. More details about file access permission please reference this document.
You can gain access to files and folders on a removable device by calling the file picker (using FileOpenPicker and FolderPicker) and letting the user pick files and folders for your app to access. Learn how to use the file picker in Open files and folders with a picker.
According to your code snippet, you want to access the HTML file inside the picture folder. For accessing file in picture folder please reference Files and folders in the Music, Pictures, and Videos libraries. Pay attention on the Capabilities page, select the libraries that your app manages. So the correct way to open the file and show it in the WebView may as follows:
StorageFolder storageFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.PicturesLibrary);
StorageFile indexFile = await storageFolder.GetFileAsync("index.html");/*Change to your file path inside the picture folder*/
browser.NavigateToString(await FileIO.ReadTextAsync(indexFile));
You may find I used the NavigateToString method. The Navigate(Uri) method can not navigate to a file by path directly. To load uncompressed and unencrypted content from your app’s LocalFolder or TemporaryFolder data stores, use the Navigate method with a Uri that uses the `ms-appdata scheme, to HTML content in the app package using the ms-appx-web scheme. For example:
webView1.Navigate("ms-appx-web:///help/about.html");
More details please reference "Navigating to content" of WebView. And the scenario 5 of the official sample provide samples about navigating to file you can reference.

Download all available (and new) files

I'm using NSURLSessionDownloadTask to download some .mov files from a web and storing them in my app.
Now what I'd like to achieve is to
download ALL files of certain type (in this case .mov) available on the page, without having to specify every file URL
download files ONLY if they are not already stored in my app.
Is there any way to achieve this?
You would have to scrape that html page to get all the urls (.mov) you are looking for. Either you can use NSXMLParser if you want to write your own or you can google some library.
When you download a file, persist some metadata (eg. name or some unique identifier) either in SQLite or CoreData, so that you can check if the file has already been downloaded.

Restoring/creating missing media references in Umbraco Media section

I have an Umbraco (v6.1.6) website, hosted on Azure Hosted (Website & DB).
Recently the client reported, that some images have disappeared from the website!
Looking at the CMS back office, the content nodes are referencing media items, but 'some' of those items are no longer present in the media section! The media files are however present on the web server in the /media folder as expected!
Now, this should be running as a single instance site, but looks like the site was run in with multiple(3) instances for a while, such as when the missing images were loaded.
[All the unaffected media has lower id’s (<10000) while the missing items in the media section have higher ids (20000’s or 50000’s)]
The site is now back to running one instance.
Q. Is there a way I can re-generate the items in the Umbraco Media section, based on the media actually present in the /Media folder?
What you need to do depends a lot on the state of your site and what has been going on while it was running in 3 instances... and what you want the outcome to be!
Metadata for media in umbraco is stored in the database and the actual files are stored on disk. If your site has been running in 3 instances using the same database but different file locations on disk, you should actually be seeing that the media items exist in the database even though the files might be scattered in the 3 instances on the file system.
It however sounds like you're saying that the files all do exist on disk, but the media items not all exist in the database. Can you confirm this (as it sounds really strange unless you have been running 3 different databases also).
All in all, everything here sounds really strange since running 3 instances should also require you to have had this running and accessed by the editors uploading the files, using 3 different hostnames?
No matter what I don't think theres a simple solution to your problem. There's no way to have umbraco "reindex" the media folder based on the files there. What I have done for broken media libraries (usually self inflicted breakage, that is) is to load up all existing media items in memory and then loop through the file system to see what is missing from the library and recreate those media items and upload the files to them. Do remember to log which files you are recreating as media items so you can do a file system delete of the orphaned files after they have been processed.
If you can shed a bit more light on the issue, I will see if I can come up with a better solution for you.

Resources