How to change icon/emblem of a directory from bash - bash

I'm playing around with get_iplayer (fantastic) it's running every few hours to grab any new episodes of whatever....
After it has finished grabbing anything new i'd like to change the emblem of ~/Videos to add a plus or star (nautilus emblem preferably)
Do i go about this via nautilus?
Do i need to change something in gnome-config?
I'm sure this can't be FS level?
Cheers for any links and advice.

gvfs-set-attribute ~/Videos -t stringv metadata::emblems new urgent
gvfs-set-attribute -t string $FOLDER metadata::custom-icon file:///home/user/path/to/icon.jpg

There's a package called libnautilus that provides tools for working with nautilus, including emblems. It's what Dropbox uses, for example, to add emblems showing sync status. You could try looking at the source of that.

Related

Search an image in a directory

I have a project in which I have lots of different images. Once in a while, we are adding more images inside it, but before, we need to check if it already existed (because we added it previously).
We were doing this right now manually, looking for the image in the folders, but as the project got bigger, it's pretty time consuming.
SO, I would like to create a script that given an image, it looks in a directory to check if it exists.
Do you know if there is any command line based tool or something I can use to build a script to do this?
There is the fdupes utility which does byte to byte comparison. It has a -d or --delete option which will prompt you to ask which files it should keep when it finds duplicates. If you don't care about the filename you can ask it to keep only the first one:
fdupes --delete --noprompt
If you want to delete images that look the same but are slightly different, it's an image recognition problem which I guess does not have such a straightforward solution.

RoboHelp CSH always goes to the first help page

I have a WebHelp content directory created using RoboHelp 9. From a web application, I'm trying to display a specific help page using their CSH JavaScript API:
RH_ShowHelp(0, "WebHelp/index.htm>MainWindow", HH_HELP_CONTEXT, <some map id>);
The problem is, the resultant popup always displays the first help topic, regardless of the map id I pass. Does the map file that was created for the RoboHelp project need to be included somewhere in the resultant WebHelp directory? I would think that RoboHelp would handle including whatever it needed in the generated content.
I think what's more likely is that I messed up somewhere in generating the map file/ids. To generate the map ids, I did the following:
Created a new map file
Double clicked it to open the map file window
Selected everything from the right list block (all the topics and help sections)
Clicked 'Auto Generate'
Are there further steps I need to follow before CSH will work?
Perhaps you forgot to include your mapfile in the generated output.
This is done in Web Help, under Content Categories.
Then, you can specify the topic number in the last argument to RH_ShowHelp.
Are you using the published output (not the generated output) in your content directory?
If that doesn't help, you can use simple links like this, which open the specified topic in help in the Help framework:
http://example.com/WebHelp/index.htm#someSubfolderThatIsAChildOfTheRootHelpFolder/theTopicYouWant.htm

Grit remove file in commit

I using Grit/Git as a database to track files added to a blog.
I can't find any example of how I would delete a file from the index. I still want to be able to have the file in my Git history (being able to get it by going back in commit history), but I want to remove it from my current HEAD.
Any tips or tricks?
http://www.kernel.org/pub/software/scm/git/docs/git-rm.html is probably what you need. Note that you'll need to use good old fashioned rm to remove it from the working tree.
This should work:
require 'grit'
repo_path = '/Users/alagu/code/myproject/'
removable_file = '/Users/alagu/code/myproject/file.txt'
repo = Grit::Repo.new(repo_path)
Dir.chdir(repo_path)
repo.remove([removable_file])
repo.commit_index "Deleted #{removable_file}"

Any way to rename image filenames?

Is there any way to make the "image" module store files under a new name on upload? Basically, someone could upload a file that says something like "macs are cool" or something equally absurd. Now, I don't want people to see that. I'd much rather have all the files renamed on upload to something like: "111494949478383.jpg". How would I go about accomplishing this?
The FileField Paths module should do what you want. It works with both core Upload, as well as the FileField and Imagefield modules. You may also want to check out Imagefield Tokens, which allows the use of node tokens in things like the default alt text for images.
You can use the module "filefield Paths", and put in the filename [raw] that way the uploaded picture will have the node's timestamp creation time.
Also you can use [raw]_[filename].[file-extension] or whatever combination you can use, take a look at "file name replacement patterns"
with hook_nodeapi you could move the files and rename the images when the node is saved.
Or you could add something to the image upload callback with hook form alter to rename the image once it has been uploaded
yep, form_alter is the way to go for this
there are file modules that basically use tokens to do this
edit also imagefield supports tokens http://drupal.org/node/152640
immagefield could be better in long run if cck going to Drupal 7
hope that helps

Get all files from VSS for a given date?

Is there a way I can ask Visual source safe to get all the files from a given date for a project? We don't use labels, so I can't roll back to a specific label and am hoping that I can somehow just call a certain date range to get the files as they existed on a specific date? Impossible?
As far as I know you have to use the get command at a command prompt, not the gui. Something like this should do:
ss Get "$/AFolder" -R -Vd15-03-2009;2:00a
The -R option makes the get recursive and the -vd option gets the version at the specified date.
You can right-click the project, choose Show History and get the version of a given date from the history explorer.
Using SourceSafe: Get by Date
http://web.archive.org/web/20120615102028/http://brennan.offwhite.net/mtblog/archives/000282.htmll
Using the command line, use the get command with the -Vd parameter
ss get $/Project -R -GTU -Vd4/30/2009;3:00a
I'm not sure, but I don't think there is a way to do this with the ui.

Resources